Without X-Pack I can set default index with the following curl command:
curl --verbose -POST http://kibana:5601/api/saved_objects/index-pattern -H "kbn-version: $KIBANA_VERSION" -H 'Content-Type: application/json;charset=UTF-8' -H 'User-Agent: Mozilla/5.0' -H 'Accept: Application/json, text/plain, /' -H 'DNT:1' -d '{"attributes":{"title":"events-*","timeFieldName":"@timestamp","notExpandable":true}}'
I tried the same with X-Pack installed and it does not work.
I also tried the following but it does not change the index:
Note: Unnecessary use of -X or --request, POST is already inferred.
Trying 10.68.32.177...
TCP_NODELAY set
Connected to kibana (10.68.32.177) port 5601 (#0)
Server auth using Basic with user 'ericsson'
POST /api/kibana/settings/defaultIndex HTTP/1.1
Host: kibana:5601
Authorization: Basic ZXJpY3Nzb246ZXJpY3Nzb24=
Accept: /
kbn-version:5.6.3
User-Agent: Mozilla
Content-Type: application/json
kbn-name:kibana
Content-Length: 20
upload completely sent off: 20 out of 20 bytes
< HTTP/1.1 200 OK
< kbn-name: kibana
< kbn-version: 5.6.3
< kbn-xpack-sig: 1028c92db5fd0f241c63cccd5da55232
< content-type: application/json; charset=utf-8
< cache-control: no-cache
< content-length: 153
< Date: Fri, 24 Nov 2017 11:19:11 GMT
< Connection: keep-alive
<
Connection #0 to host kibana left intact
{"settings":{"defaultIndex":{"userValue":"events-*"},"xPackMonitoring:allowReport":{"userValue":false},"xPackMonitoring:showBanner":{"userValue":false}}}
I have created a user with password which I can log into Kibana with.
I am creating documents and store them in elasticsearch using the same credentials.
An I can retrieve the documents as well.
What I can not do is to set the default index at startup of kibana.
Setting it manually via the gui works but that does not help me.
I want it configured at start.
upload completely sent off: 85 out of 85 bytes
< HTTP/1.1 200 OK
< kbn-name: kibana
< kbn-version: 5.6.3
< kbn-xpack-sig: 1028c92db5fd0f241c63cccd5da55232
< content-type: application/json; charset=utf-8
< cache-control: no-cache
< content-length: 148
< Date: Fri, 24 Nov 2017 12:47:46 GMT
< Connection: keep-alive
<
Connection #0 to host kibana left intact
{"id":"AV_uEc_V2io_oD0oo2If","type":"index-pattern","version":1,"attributes":{"title":"events-*","timeFieldName":"@timestamp","notExpandable":true}}
But when doublechecking in gui, I do not see that default index has updated to events-*.
Instead the old default index is no longer default:
I manually have to create a new one:
I don't think there is any code in Kibana server that will automatically set a default index pattern. We do, however, have code in Kibana client that will do that.
Are you sure that a default index pattern is created after this curl command, and not after loading Kibana? You can easily verify by removing all existing index patterns, running this curl command, then running: curl -XGET localhost:5601/api/kibana/settings and see if you see the defaultIndex field.
Oh, so if I understand this correctly, you're saying that you did an extra curl command? Specifically the one you found that the browser made to set the default index?
Assuming that's true, you're saying that these steps work fine without x-pack but not with it, right?
I think the core problem is that you're using the index pattern title instead of the id. That changed in 5.6. Instead of posting -d '{"value": "events-*"}', try using the index pattern id, which you can see from the /saved_objects/index-pattern endpoint.
However, this behavior should be consistent between x-pack and non x-pack
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.