Skip to content

Index mappings ignored by templates #37208

@kobelb

Description

@kobelb

The changes introduced by #36924 make it so that mappings specified at index creation time are ignored, and index template mappings take precedent.

After these changes, if you create an index template:

PUT _template/test
{
  "index_patterns": ["test"],
  "mappings": {
    "_doc": {
      "properties": {
        "foo": {
          "type": "keyword"
        }
      }
    }
  }
}

and then create an index which adds a new property:

PUT test
{
  "mappings": {
    "_doc": {
      "properties": {
        "bar": {
          "type": "keyword"
        }
      }
    }
  }
}

The created mappings will only have the properties defined in the template:

GET test/_mapping
{
  "test" : {
    "mappings" : {
      "_doc" : {
        "properties" : {
          "foo" : {
            "type" : "keyword"
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

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