# Programmatically backup existing index pattern

**URL:** <https://discuss.elastic.co/t/programmatically-backup-existing-index-pattern/258058>\
**Category:** Kibana\
**Created:** [December 8, 2020, 10:32pm UTC](https://discuss.elastic.co/t/programmatically-backup-existing-index-pattern/258058 "2020-12-08T22:32:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [December 8, 2020, 10:32pm UTC](https://discuss.elastic.co/t/programmatically-backup-existing-index-pattern/258058/1 "2020-12-08T22:32:38Z")

</div>

I have 2 index patterns that are named exactly the same. One of them must be deleted to reduce confusion. When I get the json of them (through dev tools), I can see slight differences between them. I want to back them up through dev tools or curl, before deleting them.

All of the examples I'm seeing for writing an index pattern through curl does not contain all the fields that I see in the json for the existing index patterns. What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![Matt\_McGovern](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matt_mcgovern/32/90131_2.png) [@Matt\_McGovern](https://discuss.elastic.co/u/Matt_McGovern)\
**Post date:** [December 10, 2020, 3:28pm UTC](https://discuss.elastic.co/t/programmatically-backup-existing-index-pattern/258058/2 "2020-12-10T15:28:47Z")

</div>

I thought all that field mapping info was needed to be kept, but it's not. To recreate an index pattern you only need the following:  
index pattern  
id (should have index pattern pasted in here instead of a guid)  
timestamp field

This is fine to do within the UI, instead of dev tools or curl.

Make sure to examine the relationships of all saved objects (dashboards/visualizations) to make sure the ID of the referenced index pattern is what you want, otherwise they will need to be migrated to use the correct index pattern.

My problem is solved.

---

<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:** [January 7, 2021, 3:28pm UTC](https://discuss.elastic.co/t/programmatically-backup-existing-index-pattern/258058/3 "2021-01-07T15:28:54Z")

</div>

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