-
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
Dynamic templates should be deduplicated #28988
Comments
Pinging @elastic/es-search-aggs |
Perhaps we should actually throw an error in the case of duplicate templates, as this would likely not be intentional and could indicate a mistake on the part of the user. |
Currently the same `dynamic_templates` name can be used more than once in the same mappings file. This most certainly is unintentional and can create issues like those reported in elastic#28988. Furthermore, when templates are matched later in `RootObjectMapper#findTemplate`, it looks like we simply pick the first matching one we see in the input array, so using the same template name twice sounds like an error prone idea anyway. This change checks for duplicate names on parsing and throws an error if we encounter the same name twice. Closes elastic#28988
As pointed out in the PR above, simply disallowing duplicate names - although it might still be desireable - is not as straight forward since users like APM (see #29200) might rely on this, although it also creates issues on their side. Just mentioning here to cross-link for the next time this issue is visited. |
Simply erroring on duplicate template names seems to be to fragile, but looking at |
Currently the same dynamic_templates can be defined more than once by error in the same mappings file. This most certainly is unintentional and can create issues like those reported in elastic#28988. This change checks for duplicates while parsing and throws an error if we encounter the same definition twice. Closes elastic#28988
We discussed this with the team and the problems create when there are multiple duplicate keys in the dynamic_template mapping |
I opened #53326 with some more detail about out discussion around deprecating and removing the possibility of having the same template names in |
Since the plan for the full removal of duplicate dynamic template names spans multiple versions, maybe we could add #52062 still as a short-term solution for at least the problem described here (accidentally programmatically adding the same section over and over again?). @jtibshirani wdyt? |
@cbuescher my intuition is that we should just focus on #53326 (and close #28988 and #52062 in favor of that issue). I could see some users accidentally having duplicate entries in their templates, especially with long templates or those that are created programmatically. So if we added #52062, I think we would also want a deprecation period before we disallow duplicate templates entirely. It seems simplest for both us and users if we only performed the combined change described in #53326. |
Closing in favor of #53326. |
Bug Report / Feature request:
Check for identical entries in the list of dynamic templates and deduplicate or reject them to avoid bloating.
Describe the issue:
It is currently possible to have the same dynamic template definition appended multiple times in the dynamic templates list of a mapping or a template, which can result to significant performance degradation.
See example template of an actual problematic 300.000 lines+ configuration installed in a cluster due to a repetition when putting the dynamic templates. This eventually resulted in a slowdown, tasks piling up, causing rejected bulks etc.
Elasticsearch version: issue exists up to current - 6.2.2
Steps to reproduce:
PUT the same dynamic template definition multiple times when defining a mapping or a template:
The text was updated successfully, but these errors were encountered: