Unable importing json file from kibana UI

I am facing this issue while import json file from kibana ui (saved object -> import) even though when I checked the json file its a invalid one checked under this https://jsonlint.com.

Even I am not able to perform post curl command for this to import ,error received as :- "type":"visualization","error":{"statusCode":409,"message":"version conflict, document already exists"}},

Can anyone help on this?

What is the content of the json file? How would you like to use that data?

@mattkime .. content is a normal collection of 5 visualizations in one dashboard and I have called the restapi to create json format and then deleted that dashboard from kibana and want to call restapi (curl command ) to import dashboard in kibana.

But while performing import api it gives me error as :
"type":"visualization","error":{"statusCode":409,"message":"version conflict, document already exists"}},

Hi @Swati123, if you're trying to call the API to create the visualizations and dashboard, I believe you just need to add ?overwrite=true to the query to avoid getting 409 errors.

If you're trying to use the import UI, the file to import has a different format than what the saved object APIs returns. The attributes of each object in the array are prefixed with an underscore and are named differently (ex: _source instead of attributes, etc).

Import file example for a single visualization:

[
  {
    "_id": "saved_object_connected_to_saved_search",
    "_type": "visualization",
    "_source": {
      "title": "saved object connected to saved search",
      "visState": "{\"title\":\"PHP Viz\",\"type\":\"horizontal_bar\",\"params\":{\"type\":\"histogram\",\"grid\":{\"categoryLines\":false,\"style\":{\"color\":\"#eee\"}},\"categoryAxes\":[{\"id\":\"CategoryAxis-1\",\"type\":\"category\",\"position\":\"left\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\"},\"labels\":{\"show\":true,\"rotate\":0,\"filter\":false,\"truncate\":200},\"title\":{}}],\"valueAxes\":[{\"id\":\"ValueAxis-1\",\"name\":\"LeftAxis-1\",\"type\":\"value\",\"position\":\"bottom\",\"show\":true,\"style\":{},\"scale\":{\"type\":\"linear\",\"mode\":\"normal\"},\"labels\":{\"show\":true,\"rotate\":75,\"filter\":true,\"truncate\":100},\"title\":{\"text\":\"Count\"}}],\"seriesParams\":[{\"show\":true,\"type\":\"histogram\",\"mode\":\"normal\",\"data\":{\"label\":\"Count\",\"id\":\"1\"},\"valueAxis\":\"ValueAxis-1\",\"drawLinesBetweenPoints\":true,\"showCircles\":true}],\"addTooltip\":true,\"addLegend\":true,\"legendPosition\":\"right\",\"times\":[],\"addTimeMarker\":false},\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"schema\":\"metric\",\"params\":{}}]}",
      "uiStateJSON": "{}",
      "description": "",
      "savedSearchId": "c45e6c50-ba72-11e7-a8f9-ad70f02e633d",
      "version": 1,
      "kibanaSavedObjectMeta": {
        "searchSourceJSON": "{\"filter\":[],\"query\":{\"query\":\"\",\"language\":\"lucene\"}}"
      }
    },
    "_meta": {
      "savedObjectVersion": 2
    }
  }
]

@mikecote Thanks Mike for the clarification.
Will check both ways.

1 Like

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