Programmatically set Kibana's default index pattern

前端 未结 2 1970
无人及你
无人及你 2020-12-28 20:33

A Kibana newbie would like to know how to set default index pattern programmatically rather than setting it on the Kibana UI through web browser during the first time viewin

2条回答
  •  北海茫月
    2020-12-28 20:42

    Elasticsearch stores all Kibana metadata information under .kibana index. Kibana configurations like defaultIndex and advance settings are stored under index/type/id .kibana/config/4.5.0 where 4.5.0 is the version of your Kibana.

    So you can achieve setting up or changing defaultIndex with following steps:

    1. Add index to Kibana which you want to set as defaultIndex. You can do that by executing following command:

      curl -XPUT http://:9200/.kibana/index-pattern/your_index_name -d '{"title" : "your_index_name",  "timeFieldName": "timestampFieldNameInYourInputData"}'
      
    2. Change your Kibana config to set index added earlier as defaultIndex:

      curl -XPUT http://:9200/.kibana/config/4.5.0 -d '{"defaultIndex" : "your_index_name"}'
      

    Note: Make sure your giving correct index_name everywhere, valid timestamp field name and kibana version for example if you are using kibana 4.1.1 then you can replace 4.5.0 with 4.1.1 .

提交回复
热议问题