Skip to content

PUT mapping with with search_analyzer and update_all_types does not actually update all types  #16239

@brwe

Description

@brwe

Or toXContent is broken.

Reproduce:

DELETE test_index

PUT test_index
{
  "mappings": {
    "type1": {
      "properties": {
        "field": {
          "type": "string"
        }
      }
    },
    "type2": {
      "properties": {
        "field": {
          "type": "string"
        }
      }
    }
  }
}

GET test_index/_mapping/field/field?include_defaults

PUT test_index/type1/_mapping?update_all_types
{
  "properties": {
    "field": {
      "type": "string",
      "search_analyzer": "keyword",
      "analyzer": "default"
    }
  }
}

In the mapping I retrieve with the GET _mapping API in the mapping only type1 is updated, although with the GET field mapping API I get the correct mapping.

GET test_index/_mapping

{
  "test_index": {
    "mappings": {
      "type1": {
        "properties": {
          "field": {
            "type": "string",
            "analyzer": "default",
            "search_analyzer": "keyword"
          }
        }
      },
      "type2": {
        "properties": {
          "field": {
            "type": "string"
          }
        }
      }
    }
  }
}

GET test_index/_mapping/field/field


{
  "test_index": {
    "mappings": {
      "type2": {
        "field": {
          "full_name": "field",
          "mapping": {
            "field": {
              "type": "string",
              "analyzer": "default",
              "search_analyzer": "keyword"
            }
          }
        }
      },
      "type1": {
        "field": {
          "full_name": "field",
          "mapping": {
            "field": {
              "type": "string",
              "analyzer": "default",
              "search_analyzer": "keyword"
            }
          }
        }
      }
    }
  }
}

When I restart the node the change has vanished from the field mapping result but still is in the get mapping result.

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