Facing some issues in creating index patterns using the python elasticsearch API

Hello,

I want to create an index pattern on Kibana through the python API also set the default timeFieldName to @timestamp. However, I am a little confused in regards to the API documentation provided by Elasticsearch-py.

To elaborate, I want to have a Jenkins job that checks whether certain index patterns are available (I do this using the Index exists API). If a certain index pattern does not exist, I want to create it programmatically using the Index create API. I also want to set the timeFieldName for the index pattern to the default @timestamp field. This is where I'm a little confused.

I do see that there is an option "timeFieldName" field in the create index pattern API. However, when I look at the elasticsearch-py API documentation for the same, I see no mention of it.

May I know where I should specify the index pattern fields as mentioned in the elastic guide API documentation? I could just translate the CURL command into python and issue the API call that way, but I figured that there would be a proper way to manage this through the python API.

Hi Rahul,

elasticsearch-py is a client that only works with Elasticsearch APIs. The create index pattern API is a Kibana API and there are no client libraries for this API so you will have to create your own HTTP request to use the API.