Skip to content

Dynamic templates should be deduplicated #28988

Closed
@kostasb

Description

@kostasb

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.*"
          }
        }
      ]
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search Foundations/MappingIndex mappings, including merging and defining field types>bugTeam:Search FoundationsMeta label for the Search Foundations team in Elasticsearch

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions