Skip to content

multi dynamic_templates incorrect #29200

@cyinll

Description

@cyinll

Elasticsearch version (bin/elasticsearch --version): 5.3.0

Plugins installed: []

JVM version (java -version): 1.8

OS version (uname -a if on a Unix-like system):

Description of the problem including expected versus actual behavior:

Steps to reproduce:

  1. create template with dynamic_templates in mappings
PUT /_template/dynamic
{
  "template" : "*",
  "mappings": {
    "default": {
      "dynamic_templates": [
        {
          "string_as_text": {
            "match": "*_text",
            "match_mapping_type": "string",
            "mapping": {
              "type": "text",
              "analyzer": "ik_max_word"
            }
          }
        }
      ]
    }
  }
}
  1. create index with dynamic_templates in mappings
PUT /test_dynamic
{
  "mappings": {
    "default": {
      "dynamic_templates": [
        {
          "string_as_text": {
            "match_mapping_type": "string",
            "mapping": {
              "type": "text",
              "analyzer": "ik_max_word"
            }
          }
        }
      ]
    }
  }
}
  1. get index mappings, i hope it use the second dynamic_templates without 'match' parameter, but it will use the first
GET /test_dynamic/_mappings

{
  "test_dynamic" : {
    "mappings" : {
      "default" : {
        "dynamic_templates" : [
          {
            "string_as_text" : {
              "match" : "*_text",
              "match_mapping_type" : "string",
              "mapping" : {
                "analyzer" : "ik_max_word",
                "type" : "text"
              }
            }
          }
        ]
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions