Export/Import Dashboards and Associated visualization's

I am trying to write a python script that pulls all the dashboards, Saved searches, Index and Visualization's from the .kibana index and then store it as a JSON file in my local system. My question is what is the query to pull all the dashboards or Visualizations in elastic search 6.3? . I tried the following query
" GET /.kibana/visualization/_search?pretty&size=50 " and it worked perfectly for elastic search 6.2 but the same query doesn't work in 6.3 version. Am i missing anything here? Thanks and your help will be much appreciated.

Note : I am a newbie to the ELK and i did went through the saved objects API documentation but couldn't figure it out.

Hey @karthik13,

Would Find Saved Objects API do the job for you?

For example:

 $ curl 'http://localhost:5601/api/saved_objects/_find?type=index-pattern&per_page=10000' -H 'Accept: application/json'


I tried the above following query but it didn't work. I have attached the screenshot for your reference:

Meanwhile, i tried the following query " GET /.kibana/_search?pretty&size=50 " and this gives me all the dashboards,index,searches etc. but i need to write a query that gives me only a list of dashboards or index so that it will be easy for me to loop through in the python script.

Well, Kibana Saved Objects API isn't meant to be used from Dev Tools Console - it's just a "normal" curl request you'd usually make from terminal or python script you mentioned.

And also read the first paragraph from https://www.elastic.co/guide/en/kibana/6.3/saved-objects-api.html#saved-objects-api that explains why you don't want to read from or write to .kibana index directly. Saved Objects API was created to guard you from all kind of issues.

My bad!. I tried your command inside the python script and it worked like a charm. Thanks for the note regarding the read or write operation in .kibana index. I appreciate your time and effort.

Hey @azasypkin
I was successfully able to export all the dashboards, index and Visualization's in a JSON format but i am unable to import the same thing in the kibana. It shows me a " Saved Objects : Saved objects file format is invalid and cannot be imported" error. Any idea about this issue? Thanks for your time.

How do you import exactly? I guess you should be able to import with saved object create API and/or saved object update API.

Hi @azasypkin,
Thanks for your amazing help and quick responses. I am able to export/import dashboards now and hence closing this topic now.
Have a nice day !

1 Like

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