Export Saved Objects via REST APi

Hi @David_McClain,

I have been in the same situation before and this is how I made it work:

  • I accessed the Kibana index (.kibana by default) directly through the Elasticsearch API, because the internal Kibana import/export API is not documented and I wanted to be able to import the saved objects before Kibana starts.
  • In order to store the state in version control, a custom script would...
    • dump the mappings of the Kibana index (GET ${ES_HOST}/${KIBANA_INDEX}/_mapping)
    • dump the kibana settings (GET ${ES_HOST}/${KIBANA_INDEX}/config/${KIBANA_VERSION}/_source)
    • list the dashboards, visualizations,searches and index-patterns: (GET ${ES_HOST}/${KIBANA_INDEX}/dashboard,visualization,search,index-pattern/_search + some json parsing)
    • dump the dashboards, visualizations, searches and index-patterns (GET ${ES_HOST}/${KIBANA_INDEX}/${OBJECT_TYPE}/${OBJECT_ID}/_source)
  • When provisioning a new cluster and Kibana a script would...
    • load the mappings into the Kibana index (PUT ${ES_HOST}/${KIBANA_INDEX})
    • load the settings and saved objects (PUT ${ES_HOST}/${KIBANA_INDEX}/${OBJECT_TYPE}/${OBJECT_ID})

If you don't want to modify the settings or saved objects, an export tool like elasticdump might be useful. To selectively export only specific saved objects and their dependencies custom code has to be written at the moment.

This setup would allow for provisioning of the Kibana settings and saved objects before Kibana has been started and before the environment has been populated with data.

2 Likes