# Index pattern timeFieldName is getting changed when using CURL command for creation

**URL:** <https://discuss.elastic.co/t/index-pattern-timefieldname-is-getting-changed-when-using-curl-command-for-creation/237118>\
**Category:** Kibana\
**Created:** [June 15, 2020, 11:09am UTC](https://discuss.elastic.co/t/index-pattern-timefieldname-is-getting-changed-when-using-curl-command-for-creation/237118 "2020-06-15T11:09:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![manojkrishna561994](https://avatars.discourse-cdn.com/v4/letter/m/439d5e/32.png) [@manojkrishna561994](https://discuss.elastic.co/u/manojkrishna561994)\
**Post date:** [June 15, 2020, 11:09am UTC](https://discuss.elastic.co/t/index-pattern-timefieldname-is-getting-changed-when-using-curl-command-for-creation/237118/1 "2020-06-15T11:09:01Z")

</div>

I have a bash script which creates index-pattern using the below curl command and after that http\_poller\_plugin is run.

```
" curl -X POST 'localhost:5601/api/saved_objects/index-pattern/lucy_data' -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
{
  \"attributes\": {
\"title\": \"lucy_data\",
\"timeFieldName\": \"created_at\"
  }
}'
"

```

Now, the issue comes, when i run this script, the index-pattern is created using `timeFieldName: created_at` values and initially everything is working fine when i apply date-time filter and after sometime when i checked the date-time filter again, it was not working as it was before. So i have checked in `Management> index-patterns` and the timeFieldName value got changed to @timestamp.

How is this happening? I have not changed anything or added data at least.

Is this expected behaviour when using the CURL command to create index-pattern or indices created with "name" instead of uuid?

---

<div class="post-metadata">

**Author:** ![wylie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/wylie/32/81794_2.png) [@wylie](https://discuss.elastic.co/u/wylie)\
**Post date:** [June 15, 2020, 7:22pm UTC](https://discuss.elastic.co/t/index-pattern-timefieldname-is-getting-changed-when-using-curl-command-for-creation/237118/2 "2020-06-15T19:22:47Z")

</div>

The only process that regularly updates index patterns at all is when clicking on fields in Discover, where we update the field popularity. I suspect that the issue here is that you are creating an index pattern without also telling the index pattern about the `created_at` field, something like this:

```auto
{
  "attributes": {
    "title": "lucy_data",
    "timeFieldName": "created_at",
    "fields": '[{"name":"created_at","type":"date","esTypes":["date"],"count":0,"scripted":false,"searchable":true,"aggregatable":true,"readFromDocValues":true}]'
  }
}

```

---

<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:** [July 13, 2020, 7:22pm UTC](https://discuss.elastic.co/t/index-pattern-timefieldname-is-getting-changed-when-using-curl-command-for-creation/237118/3 "2020-07-13T19:22:50Z")

</div>

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