# Update index patterns automatically - programatically?

**URL:** <https://discuss.elastic.co/t/update-index-patterns-automatically-programatically/129547>\
**Category:** Kibana\
**Created:** [April 25, 2018, 6:25pm UTC](https://discuss.elastic.co/t/update-index-patterns-automatically-programatically/129547 "2018-04-25T18:25:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Bardo](https://avatars.discourse-cdn.com/v4/letter/r/e9bcb4/32.png) [@Robert\_Bardo](https://discuss.elastic.co/u/Robert_Bardo)\
**Post date:** [April 25, 2018, 6:25pm UTC](https://discuss.elastic.co/t/update-index-patterns-automatically-programatically/129547/1 "2018-04-25T18:25:05Z")

</div>

Hello,

Is there a solution / API function that allows for updating the index patterns programmatically? Opposed to the UI?

Thank you!

---

<div class="post-metadata">

**Author:** ![jen-huang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jen-huang/32/74327_2.png) [@jen-huang](https://discuss.elastic.co/u/jen-huang)\
**Post date:** [April 25, 2018, 6:37pm UTC](https://discuss.elastic.co/t/update-index-patterns-automatically-programatically/129547/2 "2018-04-25T18:37:05Z")

</div>

Currently there is no great way to do this. Eventually we would like to expose an API for this, or refresh fields automatically. You can track this issue on GitHub here: [Remove index pattern mapping cache · Issue #6498 · elastic/kibana · GitHub](https://github.com/elastic/kibana/issues/6498)

There is a workaround solution provided here:

> [@Reloading the Index Field list automatically](https://discuss.elastic.co/t/reloading-the-index-field-list-automatically/116687/2):
>
> i don't think there is an API call to do that, but you could do it with a few steps: get the list of fields in the index pattern with: http://localhost:5601/api/index\_patterns/\_fields\_for\_wildcard?pattern=NAME\_OF\_YOUR\_INDEX&meta\_fields=["\_source","\_id","\_type","\_index","\_score"], escape returned json and update the index with: curl 'http://localhost:5601/api/saved\_objects/index-pattern/ID\_OF\_YOUR\_INDEX' -X PUT -H 'Content-Type: application/json' -H "kbn-xsrf: true" --data-binary '{"attri…

---

<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:** [May 23, 2018, 6:45pm UTC](https://discuss.elastic.co/t/update-index-patterns-automatically-programatically/129547/3 "2018-05-23T18:45:18Z")

</div>

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