Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index template regression when composed of component template with different mapping notations #105482

Closed
piergm opened this issue Feb 14, 2024 · 1 comment · Fixed by #106077
Closed
Labels
>regression :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team

Comments

@piergm
Copy link
Member

piergm commented Feb 14, 2024

Description

On 8.11.0+, if we have a component templates that defines a mapping with a different notation than the index template that uses it (dotted notation vs object with property subobject) we get a mapper parsing exception.
A concrete example of this (component template defined as object with property subobject):

PUT _component_template/component-template-test
{
  "template": {
    "mappings": {
      "properties": {
        "object": {
          "properties": {
            "subobject": {
              "type": "keyword"
            }
          }
        }
      }
    }
  }
}

While the index template that uses the component template has in the mapping definition the dotted notation:

POST _index_template/_simulate
{
  "index_patterns": [
    "smops-test-*"
  ],
  "composed_of": [
    "component-template-test"
  ],
  "template": {
    "mappings": {
      "properties": {
        "object.subobject": {
          "type": "version"
        }
      }
    }
  }
}

throws this error:

{
  "error": {
    "root_cause": [
      {
        "type": "illegal_argument_exception",
        "reason": "composable template [simulate_template_nzv683ensognv2oxiqvyca] template after composition with component templates [component-template-test] is invalid"
      }
    ],
    "type": "illegal_argument_exception",
    "reason": "composable template [simulate_template_nzv683ensognv2oxiqvyca] template after composition with component templates [component-template-test] is invalid",
    "caused_by": {
      "type": "illegal_argument_exception",
      "reason": "invalid composite mappings for [simulate_template_nzv683ensognv2oxiqvyca]",
      "caused_by": {
        "type": "mapper_parsing_exception",
        "reason": "Failed to parse mapping: mapper [object.subobject] cannot be changed from type [keyword] to [version]",
        "caused_by": {
          "type": "illegal_argument_exception",
          "reason": "mapper [object.subobject] cannot be changed from type [keyword] to [version]"
        }
      }
    }
  },
  "status": 400
}

The same happens if the dotted notation is used in the component template while the object with property subobject is used in the index template.
This was not the case in versions < 8.11.0. The regression was possibly introduced by #97317

@piergm piergm added >regression :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team labels Feb 14, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>regression :Search/Mapping Index mappings, including merging and defining field types Team:Search Meta label for search team
Projects
None yet
2 participants