Creating Kibana visualization using json

I asked same question to elasticsearch community, but there is no reply.
This topic is related to both Kibana and Elasticsearch
So I'm asking same question here.

I had created visualization by using elasticsearch REST API.
In elk 2.x version, this method worked fine.
However, after I updated my elk to 6.2.1, there are some problems.

Version 2.x...
I created visualization using REST API like this.
curl -X PUT --data @[visualization_id].json 'http://localhost:9200/.kibana/visualization/[visualization_id]'
Everytthing was fine.. life was so happy.

However, in Version 6.x
If u try same method, u will get error message. It's about type, elasticsearch has only one type, doc.
Previously u created visualization with type 'visualization'
So, I changed url little bit..
curl -X PUT --data @[visualization_id].json 'http://localhost:9200/.kibana/doc/[visualization_id]' -H 'Content-Type: application/json'

I successfully created visualization, and also check created visualization list in kibana.
However.., when i click the visualization I created using REST API
Kibana says "Could not locate that visualization (id: ...)"
When u use GUI to create visualization, Kibana makes id like 'visualization:xxxx-xxxx-xxxx-xxxx'.

Does anyone know how to solve this problem?

Thanks in advance.

Hey @Sungsu_Kim, Kibana switched to using GUIDs for the ids of saved objects in 6.x, and the format of the underlying Visualizations might have changed as well. Have you tried to use the Saved Object Import/Export functionality via Kibana to migrate your objects? Directly inserting the objects into Elasticsearch isn't a supported approach to migration, and a lot changes between the different versions of Kibana that makes this approach quite brittle.

Thanks a lot. Your advice is really helpful. Not directly creating via Elasticsearch, rather through Kibana is right approach. I appreciate your help.

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