# Importing visualizations from different machine

**URL:** <https://discuss.elastic.co/t/importing-visualizations-from-different-machine/131617>\
**Category:** Kibana\
**Created:** [May 13, 2018, 1:03pm UTC](https://discuss.elastic.co/t/importing-visualizations-from-different-machine/131617 "2018-05-13T13:03:44Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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 14, 2018, 11:16am UTC](https://discuss.elastic.co/t/importing-visualizations-from-different-machine/131617/4 "2018-05-14T11:16:54Z")

</div>

OK, I'm half way there.  
First I was able to change the exported objects so they could be imported via cli on there machines, and I will detail how, for anyone else how encounter the same issue:

Kibana 6 objects are exported like so (visualization,searchs and dashboards have there differences, but for the changes that need to be made they are the same):

```
[
  {
    "_id": "SOME_ID",
    "_type": "visualization",
    "_source": {
      "title": "Results Table",
      "visState": "{\"title\":\"Results Table\",\"type\":\"table\",\"params\":{\"perPage\":100,\"showMeticsAtAllLevels\":false,\"showPartialRows\":false,\"showTotal\":false,\"sort\":{\"columnIndex\":2,\"direction\":\"asc\"},\"totalFunc\":\"sum\"},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}},{\"id\":\"6\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"STATUS_newValue.raw\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"customLabel\":\"Current Status\"}},{\"id\":\"7\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"DESCRIPTION_newValue.raw\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"customLabel\":\"Description\"}},{\"id\":\"8\",\"enabled\":true,\"type\":\"terms\",\"schema\":\"bucket\",\"params\":{\"field\":\"ENDDATE_newValue.raw\",\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"size\":5,\"order\":\"desc\",\"orderBy\":\"1\",\"customLabel\":\"End Date\"}}]}",
      "uiStateJSON": "{\"spy\":null,\"vis\":{\"params\":{\"sort\":{\"columnIndex\":2,\"direction\":\"asc\"}}}}",
      "description": "",
      "version": 1,
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"index\":\"SOME_ID\",\"filter\":[],\"query\":{\"language\":\"lucene\",\"query\":\"\"}}"
      }
    }
  }
]

```

The things to change:

1. Erase the array that stores the object. The saved\_object revieces only json objects.
2. searchSourceJSON field has a string value: "{...}" .In order for the api to understand that this is a string and not malformed object you need to do something simple - add space between the first and last double quotes in the value. so: searchSourceJSON: " { .... } " and not searchSourceJSON: "{...}".

That way there will be no errors when you send the objects with this curl:

`curl -XPOST localhost:5601/api/saved_objects/search -H 'kbn-xsrf:true' -H 'Content-type:application/json' -d @./full_results_search.json`

Hope this helps to anyone.

What I still need help with?  
When I import the objects, they don't have the host index id that they need to work.  
When I import in kibana, there is a prompt that asks me if I want to change the ID to one on the kibana indexs like this:

 ![kibana_import](https://us1.discourse-cdn.com/elastic/original/3X/8/5/85897ec3096b5bde5db393f809b9184a002cc2b3.JPG)

What is the cli equivalent for this process?  
Currently What I can think of is the annoying way of getting the index id from the command:  
`GET /.kibana/_search?q=type:index-pattern`  
seraching for the right index, extracting the id, and replacing the id in the objects, and then sending them via the cli.  
Is there a more elegant way to do this?

---

_[View the full topic](https://discuss.elastic.co/t/importing-visualizations-from-different-machine/131617)._
