How to set visualization/search id when importin via curl?


#1

Hi!
I have visualization and a search that I want to import with a dashboard into kibana.
When I send them just as I saved them after exporting them from their original kibana index, I get an error that the fields "_id" and "_source" are not allowed.
When I send the visualization and the search after removing all the problematic fields and adding "attributes" field it works, but when I import the dashboard there is a a problem: the dashboard needs the visualization and the search new id's to work.
Because I can't set the id just by sending it in curl, I thought about just getting the new id from the response of the import curl.
Is there a better way to set the new id beforehand so I woun't need to hassle with it?
Plus, I saw this post from Joe Fleming in this feed:

Read the dashboard (a GET operation by ID)
Read the visualizations on it (an MGET here)
Make a new copy of the visualizations, setting a new ID (the ID can be anything, Kibana just uses a UUID by default, you can do the same)
Make a new copy of the dashboard as above, and also change the IDs of the visualizations in it to the copies you just created

So implicitly I see there is a way to set visualization/search id before importing them.
What is that way?

Thanks!


(Matt Bargar) #2

Instead of talking to ES directly, I would suggest trying Kibana's Saved Object API.


#3

Sorry, I miswrote. I send via the saved object api, and not to kibana directly.


(Matt Bargar) #4

You can specify the id as the last part of the URL path. So if I wanted to create an index pattern with id foo, I could do:

POST /api/saved_objects/index-pattern/foo

(system) #5

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