# Error migrating legacy index templates to composable

**URL:** <https://discuss.elastic.co/t/error-migrating-legacy-index-templates-to-composable/314885>\
**Category:** Elasticsearch\
**Created:** [September 21, 2022, 5:15pm UTC](https://discuss.elastic.co/t/error-migrating-legacy-index-templates-to-composable/314885 "2022-09-21T17:15:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob\_Penrod](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bob_penrod/32/116702_2.png) [@Bob\_Penrod](https://discuss.elastic.co/u/Bob_Penrod)\
**Post date:** [September 21, 2022, 5:15pm UTC](https://discuss.elastic.co/t/error-migrating-legacy-index-templates-to-composable/314885/1 "2022-09-21T17:15:16Z")

</div>

I'm running into errors on ES 7.17 migrating "legacy" index templates to the new composable style.  
Given the following two templates, creating the 2nd gets an error:

```auto
PUT _index_template/test_template_1
{
  "index_patterns": ["test.*.env1.*"],
  "template": {
    "mappings": {
      "properties": {
        "created_at": {
          "type": "date",
          "format": "EEE MMM dd HH:mm:ss Z yyyy"
        }
      }
    }
  },
  "priority": 0
}
PUT _index_template/test_template_2
{
  "index_patterns": ["test.*.env2.*"],
  "template": {
    "mappings": {
      "properties": {
        "removed_at": {
          "type": "date",
          "format": "EEE MMM dd HH:mm:ss Z yyyy"
        }
      }
    }
  },
  "priority": 0
}

```

the error is

```auto
index template [test_template_2] has index patterns [test.*.env2.*] matching patterns from existing templates [test_template_1] with patterns (test_template_1 => [test.*.env1.*]) that have the same priority [0], multiple index templates may not match during index creation, please use a different priority

```

However, if I make the `priority` in one of the templates different from the other template and then create indices against them, I can see that those index patterns do not conflict.

For example, if I do `PUT /test.4.env2.1234` then `test_template_2` will match even if it has lower priority than `test_template_1`. So, the index patterns don't conflict, right?

What am I doing wrong?

---

<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 19, 2022, 5:16pm UTC](https://discuss.elastic.co/t/error-migrating-legacy-index-templates-to-composable/314885/2 "2022-10-19T17:16:06Z")

</div>

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