Today, dynamic templates can contain multiple template names with the same name. This can be the result of either adding the same template multiple times in error (like the case described in #28988 or explicitly to group small variations of the same template like mentioned in this example of an APM index templates (elastic/apm-server#2693).
This creates problems and bugs when these duplicate templates are merged e.g. during inheritance like described in elastic/apm-server#2693 (comment).
Instead, all names should be a unique ID, and we should fail when there are duplicates.
To make this change in a backwards compatible way, we should start logging warnings about this problem starting in one of the next 7.x releases.
In order to make sure that existing dynamic templates (e.g. inside index templates) still work when upgrading to 8, and we are late in the 7.x series, we need to support creating indices from “broken” existing templates (like ones uploaded in 7.1) until 8.latest.
At the same time, from now on we can start warning users when they create index templates or indix mapping containing duplicates in the dynamic_templates section. In 8.x we should start rejecting new index templates and index mappings with duplicate names, (potentially accept but forcefully rewrite them to unique IDs if request is made with version 7 compatibility requested - to be discussed)
In 9 we should aim at rejecting broken templates and new indices created from them entirely.
Open questions:
- If we allow new indices to be created from existing 7.x index templates that contain “broken” dynamic templates sections, we again have these indices in the 8.x cluster. We then might need to support them going forward to 9?
- How can we remove / rewrite existing index templates containing “broken” dynamic templates sections going forward. If e.g. folks do rolling upgrades from 7 -> 8 -> 9 they need to be rewritten at some point?
Today, dynamic templates can contain multiple template names with the same name. This can be the result of either adding the same template multiple times in error (like the case described in #28988 or explicitly to group small variations of the same template like mentioned in this example of an APM index templates (elastic/apm-server#2693).
This creates problems and bugs when these duplicate templates are merged e.g. during inheritance like described in elastic/apm-server#2693 (comment).
Instead, all names should be a unique ID, and we should fail when there are duplicates.
To make this change in a backwards compatible way, we should start logging warnings about this problem starting in one of the next 7.x releases.
In order to make sure that existing dynamic templates (e.g. inside index templates) still work when upgrading to 8, and we are late in the 7.x series, we need to support creating indices from “broken” existing templates (like ones uploaded in 7.1) until 8.latest.
At the same time, from now on we can start warning users when they create index templates or indix mapping containing duplicates in the
dynamic_templatessection. In 8.x we should start rejecting new index templates and index mappings with duplicate names, (potentially accept but forcefully rewrite them to unique IDs if request is made with version 7 compatibility requested - to be discussed)In 9 we should aim at rejecting broken templates and new indices created from them entirely.
Open questions: