Creating visualizations directly using REST API


(Sungsu Kim) #1

Hi, 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.


(system) #2

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