I would like to use a curl command to add an index pattern to my kibana index. I am using logstash to index my data and indexes looks like that: logstash-{the current date}
It's highly not recommended to write to the Kibana index directly, it's not backward compatible and may not work in some cases that can put Kibana into undefined state at some point. The recommended way is to use Saved Objects API, it supports creation of index patterns as well.
To get the idea, you can create index pattern manually and use browser dev tools to see how request and its parameters look like or tune existing index pattern and then fetch it with the same API (find/get methods) to see the shape of the index pattern you want to create with cURL.
I have more than 50 kibana instance, and I don't want to index patterns manually. I already tried to use kibana interface. but now I would like to add a shell script to write to the kibana index directly even if it is not a good idea. To use the Saved Objects API I should add the index pattern before no ?
To use the Saved Objects API I should add the index pattern before no ?
No, you can create index pattern with this API too (because index pattern is Saved Object for Kibana), please go through the docs I've linked above and let me know if there is something that's not clear.
Another question, can I have the same id when I create an index pattern? and not generate it randomly? Thanks
yes, and example in the linked docs illustrates exactly that (see my-pattern).
Nope, it should be available out of the box starting from Kibana 6.0 (every new version could change an API a bit, so that it depends on the version you use, but it shouldn't be difficult to figure out).
I would like to run this command but I don't know where.
This query format is for Kibana Dev Console, but every query example in Elastic Docs includes Copy as cURL link, so you can copy request that will work with cURL instead.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.