-
Notifications
You must be signed in to change notification settings - Fork 24.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
multi dynamic_templates incorrect #29200
Comments
So whats happening here is that dynamic templates with the same name are being merged together to produce the final template. You can see this more clearly if you add an extra setting to the index creeation command as below:
The resulting mapping is now:
Note that the mapping now includes both the It's tricky to know what to do here as its certainly useful to be able to augment rules made in a base template by adding or overriding settings in the rules in the index creation command. Maybe we should only merge the A workaround for this would be to add /cc @elastic/es-search-aggs |
We discussed this in FixItFriday and it was agreed that it is unfortunate that dynamic templates with the same name in different index templates/create index request are merged rather than replaced and we would like to change this. Another concern was raised that when merging the index template and create index request which even have different dynamic templates its not clear what the order of the dynamic templates would be in the final mappings and we should fix this too. Since this would be a breaking fix we would probably need to have a temporary setting to specify whether to merge or replace dynamic templates in mappings when merging the mappings and then switch the default of this setting in a major version and remove the setting in the subsequent major version |
I've started to look into fixing this. @colings86 there are a few points that would be helpful to clarify:
Lastly @cyinll — just a quick note that I modified the first step of your reproduction above to include the |
@jtibshirani thanks for looking into this
Yes we would like the deep merge to effectively treat the rules in the dynamic mappings as immutable blocks so rules with the same name will overwrite the existing rules rather than merge into the existing rules. You are right that this is a departure from the rest of the mapping when merging but we felt when discussing this that having this rules overwrite rather than merge makes it easier for the user to reason about how their template will be integrated with other ones. It also allows the use to specify rules that don't apply certain settings like the one in the example above. If you think this warrants another discussion I'm happy to discuss again as there might be things we did not consider before.
Great, I think adding to the docs and creating tests for this behaviour would be a good idea. |
APM creates multiple keys with the same name for default
This works fine as long as users don't add custom templates defining The issue was identified by a user, for more details see elastic/apm-server#2693 (comment) As pointed out to me by @jtibshirani the behavior seems related to the discussions on this issue. |
I opened #52062 with the current plan to deprecate and remove the ability to use the same name for dynamic templates and will close this issue because of this. |
Pinging @elastic/es-search (Team:Search) |
Closing in favour of #53326 which covers the exact same problem. |
Elasticsearch version (
bin/elasticsearch --version
): 5.3.0Plugins installed: []
JVM version (
java -version
): 1.8OS version (
uname -a
if on a Unix-like system):Description of the problem including expected versus actual behavior:
Steps to reproduce:
The text was updated successfully, but these errors were encountered: