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

**URL:** <https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300>\
**Category:** Kibana\
**Created:** [May 17, 2018, 9:51am UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300 "2018-05-17T09:51:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 17, 2018, 9:51am UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300/1 "2018-05-17T09:51:35Z")

</div>

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](https://discuss.elastic.co/t/can-i-copy-a-dashboard-and-its-associated-visulizations/94311/12) 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!

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [May 17, 2018, 7:29pm UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300/2 "2018-05-17T19:29:30Z")

</div>

Instead of talking to ES directly, I would suggest trying Kibana's [Saved Object API](https://github.com/elastic/kibana/pull/11632).

---

<div class="post-metadata">

**Author:** ![yishain11](https://avatars.discourse-cdn.com/v4/letter/y/df705f/32.png) [@yishain11](https://discuss.elastic.co/u/yishain11)\
**Post date:** [May 21, 2018, 6:20am UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300/3 "2018-05-21T06:20:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Bargs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bargs/32/5429_2.png) [@Bargs](https://discuss.elastic.co/u/Bargs)\
**Post date:** [May 23, 2018, 8:51pm UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300/4 "2018-05-23T20:51:34Z")

</div>

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:

```auto
POST /api/saved_objects/index-pattern/foo

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 20, 2018, 8:51pm UTC](https://discuss.elastic.co/t/how-to-set-visualization-search-id-when-importin-via-curl/132300/5 "2018-06-20T20:51:40Z")

</div>

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