How to export and Import Indexes and searches for Kibana using API?

I want to export and Import Kibana Indexes and Searches in to a json file using APIs.
Can we do that?
If so, how?

1 Like

You can use the Saved Objects API to export/import index patterns and saved searches, which are both Kibana Saved Objects. See Export Objects and Import Objects.

Thanks for the response Catherine.
But I am trying to call this API:
curl -X POST "http://localhost:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{
"objects": [
{
"type": "index-pattern",
"id": "4afc1210-cb86-11e8-a511-856ad0f7e2c7"
}
]
}
'
And I am getting following error:
{"statusCode":400,"error":"Bad Request","message":"child \"attributes\" fails because [\"attributes\" is required]. \"objects\" is not allowed","validation":{"source":"payload","keys":["attributes","objects"]}}

I don't know what is wrong in the API call I called.
Can you help me. Please

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