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

**URL:** <https://discuss.elastic.co/t/facing-some-issues-in-creating-index-patterns-using-the-python-elasticsearch-api/285305>\
**Category:** Kibana\
**Created:** [September 28, 2021, 5:54am UTC](https://discuss.elastic.co/t/facing-some-issues-in-creating-index-patterns-using-the-python-elasticsearch-api/285305 "2021-09-28T05:54:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kulhalli](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rahul_kulhalli/32/95154_2.png) [@Rahul\_Kulhalli](https://discuss.elastic.co/u/Rahul_Kulhalli)\
**Post date:** [September 28, 2021, 5:54am UTC](https://discuss.elastic.co/t/facing-some-issues-in-creating-index-patterns-using-the-python-elasticsearch-api/285305/1 "2021-09-28T05:54:39Z")

</div>

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](https://www.elastic.co/guide/en/kibana/7.x/index-patterns-api-create.html). However, when I look at the [elasticsearch-py API documentation](https://elasticsearch-py.readthedocs.io/en/v7.15.0/api.html#elasticsearch.client.IndicesClient.create) 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.

---

<div class="post-metadata">

**Author:** ![rudolf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rudolf/32/51200_2.png) [@rudolf](https://discuss.elastic.co/u/rudolf)\
**Post date:** [September 28, 2021, 9:06am UTC](https://discuss.elastic.co/t/facing-some-issues-in-creating-index-patterns-using-the-python-elasticsearch-api/285305/2 "2021-09-28T09:06:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 26, 2021, 9:07am UTC](https://discuss.elastic.co/t/facing-some-issues-in-creating-index-patterns-using-the-python-elasticsearch-api/285305/3 "2021-10-26T09:07:28Z")

</div>

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