Hi.
I'm trying to create a visualization in Kibana via API calls. So far i'm a little bit confused on how to do this. Please try to follow me.. and correct me if i'm wrong...
So far i discovered two types of API calls...
-
One for Elasticsearch (https://www.elastic.co/guide/en/elasticsearch/reference/current/docs.html) (which can be called even from the dev tools via kibana web). This set of APIs is called to port 9200
-
And the other set of APIs from Kibana (https://www.elastic.co/guide/en/kibana/7.x/saved-objects-api.html). This set of APIs is called to port 5601
So far i was able to get via API (Elasticsearch and Kibana) the "visualizations" or "dashboards" already created in my platform. So far so good. But the problem i have found is how to create a new Visualization or Dashboard.... which API do i need to use or which API is recommended for this task?. Seems that the Kibana API's are more suited for this... i have discovered that the API's for "Saved Objects" seems to manage the creation of dashboards and visualizations better. But here i'm a little bit lost with the documentation... for example... i want to create a Timeseries visualization and in the kibana web there are a lot of parameters to configure.... where can i find docs related to this?. so far i have run an example like this:
POST localhost:5601/api/saved_objects/visualization/mivis2
{
"attributes": {
"title": "Mi Visualizacion 2",
"visState": "{\"title\":\"Mi Visualizacion 2\",\"type\":\"timeseries\"}"
}
}
I'm getting this:
{
"type": "visualization",
"id": "mivis2",
"attributes": {
"title": "Mi Visualizacion 2",
"visState": "{\"title\":\"Mi Visualizacion 2\",\"type\":\"timeseries\"}"
},
"references": [],
"migrationVersion": {
"visualization": "7.11.0"
},
"updated_at": "2021-04-16T20:25:39.409Z",
"version": "WzIxODQzNywyXQ==",
"namespaces": [
"default"
]
}
Seems the paramenter "visState" contain the configuration for this Timeseries... but i'm not sure ...
For the latter POST i'm getting this in the web:
but I'm missing a lot of parameters...
On the other hand maybe the Kibana API is not the best way to do this and the API's for Elasticsearch is the solution?.
Can someone guide me on this matter??
Thanks!