Saved Objects Import/Export

Hi
We are using ElasticSearch and Kibana within a kubernetes environment, so periodically containers will be deleted, and recreated. I have been trying to find a way to create all the index-patterns, visualizations, and Dashboards, from API calls which we can run during the creation process of the containers.
I'm having trouble finding the way of doing this, even when using the documentation. For example, I have created 2 indexs, and a dashboard with 1 visualization, but.....

curl -X GET "http://172.17.0.2:9200/api/saved_objects/_export"
-H 'kbn-xsrf: true'
-H 'Content-Type: application/json'
-u elastic:changeme
-d '{
"type": "[visualization, dashboard, search, index-pattern]"
}';

{"_index":"api","_type":"saved_objects","_id":"_export","found":false}

Can anyone give me some help with the best process for doing this.

ps: I'm using the docker container, version 7.1.1

There is no _export endpoint, but you could use the _find endpoint to get all of the saved objects of a particular type.

If you're primarily interested in re-creating dashboards then you could also use the dashboard import/export API.

This is my problem, I have been reading and trying all these different methods from the documentation, and I get results like this:

curl:
curl -X GET "http://x.x.x.x:9200/api/kibana/dashboards/export?dashboard=ea010c90-9407-11e9-bb2b-65c8f6e0978d" -H 'kbn-xsrf: true'

result:
{"error":"no handler found for uri [/api/kibana/dashboards/export?dashboard=ea010c90-9407-11e9-bb2b-65c8f6e0978d] and method [GET]"}

I get the same when trying the import:
{"error":"no handler found for uri [/api/kibana/dashboards/import?force=true] and method [POST]"}

Does the Docker ElasticSearch container have any limitations, or require any addons...?

These APIs are hosted by Kibana and need to be sent to the Kibana server, but based on the port number in your example (9200) it looks like you are sending your requests to Elasticsearch.

1 Like

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