Description
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:
PUT my_index
{
"mappings": {
"_doc": {
"dynamic_templates": [
{
"docker.container.labels": {
"mapping": {
"type": "keyword"
},
"match_mapping_type": "string",
"path_match": "docker.container.labels.*"
}
},
{
"docker.container.labels": {
"mapping": {
"type": "keyword"
},
"match_mapping_type": "string",
"path_match": "docker.container.labels.*"
}
}
]
}
}
}