How to set default Index in kibana 6.x using CLI

This is a follow-up to How to create and set default Index in kibana 6.1 using Python
Any ideas how to sort that out?

With a little reverse engineering, I was able to get this request to work, where "myPattern" is the name of the index pattern I set as the default.

curl 'localhost:5601/api/kibana/settings' \
  -H 'content-type: application/json' \
  --data-binary '{"changes":{"defaultIndex":"myPattern"}}'

Keep in mind, this is not a public/stable API and could change at any time.

Let me know if that works for you!

Hi @joshdover, thank you for suggestion.
To make that request working, I had to add -H "kbn-xsrf: true" option.
However it returns no error, it does not help. I can't see default index in UI :frowning:

Ah you may need to add the -XPOST option as well. I may have trimmed the original command too much. Could you share what command you're using if you get it to work?

Thank you, now it's working:

curl -XPOST http://localhost:5601/api/kibana/settings \
-H 'content-type: application/json' -H 'kbn-xsrf: true' \
--data-binary '{"changes":{"defaultIndex":"logs-*"}}'

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.