Error migrating legacy index templates to composable

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:

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

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?

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