/ kibana

Kibana 4 - Import and Export Visualizations and Dashboards with Elasticdump

Kibana 4.0.0 does not allow you to save and load JSON visualizations and dashboards through its interface, Kibana 3 had an option to do this. This missing feature is planned to be part of the Kibana 4.1.0 release.

Luckily there is an workaround available. The project elasticdump allows an entire index in elasticsearch to be exported and imported in JSON format.

Exporting

The Kibana 4's index is called .kibana in elasticsearch, and with elasticdump installed you can export both the visualizations and dashboards which are stored there. To export them you can do this:

elasticdump \
	--input=http://localhost:9200/.kibana  \
    --output=$ \
    --type=data \
    --searchBody='{"filter": { "or": [ {"type": {"value": "dashboard"}}, {"type" : {"value":"visualization"}}] }}' \
    > kibana-exported.json

The --searchBody option makes sure that only the visualizations and dashboards are exported. The --output=$ is used so that it outputs the JSON to stdout before its piped into kibana-exported.json.

This one JSON will contain both the visualizations and the dashboards. You can adjust the searchBody filter to only export one of them, for example this query would only export the visualizations.

elasticdump \
	--input=http://localhost:9200/.kibana  \
    --output=$ \
    --type=data \
    --searchBody='{"filter": {"type" : {"value":"visualization"} }}' \
    > kibana-exported-visualizations.json

Importing

To import these visualizations and dashboards into another elasticsearch instance you can do this:

elasticdump \
	--input=kibana-exported.json \
    --output=http://localhost:9200/.kibana \
    --type=data

After importing you don't need to restart elasticsearch, you should see the new visualizations and dashboards when you refresh Kibana in the browser.

I personally really like this way of importing and exporting as it requires no elasticsearch plugins to be installed as elasticdump only uses the elasticsearch REST API.