Creating Index/Visualization/Dashboards via REST API V 7.1

I have created a web based front end to my data set. My front end program extracts the data and inserts it into ELK via logstash. I then want to create a visualization followed by dashboards via saved_objects REST API.
When logstash completes, there is an index shown in Elasticsearch Index Management panel. There is no index shown in the Kibana Index Patterns panel. i.e. one must be created manually. This involves selecting the index by name and then assigning a time field (normally @timestamp).

If you do a GET REST operation after logstash completes (either by curl or Postman) you get back:

curl -X GET "http://localhost:5601/api/saved_objects/_find?type=index-pattern&search_fields=title&search=*" -H 'kbn-xsrf: true' -H 'Content-Type: application/json'

"page": 1,
"per_page": 20,
"total": 0,

Once you create the index via Kibana Index Pattern manually, you get back the proper JSON.

Question: What is the Kibana REST API that needs to be used to create an kibana index from logstash ? Keep in mind that the only an ID gets created is after the manual kibana process.

If its the Create Object REST API, what JSON attributes needs to be defined.
Since the index is defined as an Elastiscsearch index, do I use Update Object?
Again,what JSON attributes needs to be defined?

Keep in mind that the GET returns no information after logstash has ingested the data.

If I understand correctly, you want to create an Index Pattern for Kibana. An index pattern can include a wildcard to match multiple index names in Elasticsearch.

Here is an example from the reference to create an index pattern using the REST API.. In the example, the my-pattern-* index pattern in Kibana will match Elasticsearch indexes named my-pattern-0, my-pattern-1, my-pattern-2, etc.

Got the create object for a index-pattern to work.
Where can I get the JSON Payload format required to Create a Visualization required in the attributes?

Hi Peter. I don't think that visualization saved objects JSON schema is documented anywhere. I would recommend creating the visualization(s) you want in Kibana and then export the saved objects to get the schema.

You can also watch the API calls in your browser's developer tools as you save a visualization to see how the payload gets sent.

Which schematic should I use ?

The one returned with GET or the export saved object one ?

They are significantly different ?

Peter Gervais
25 Fraser Street , PO Box 21

St Andrews West

K0C 2A0


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