Skip to content

More than one level of nesting with include_in_parent + include_in_root can lead to duplicate fields #26990

@jpountz

Description

@jpountz

Say your mappings look like this:

{
  "properties": {
    "foo": {
      "type": "nested",
      "include_in_root": true,
      "include_in_parent": true
    }
  }
}

Then we make sure to only copy to the root if it is different from the parent document. However if you start having more than one level of nesting:

{
  "properties": {
    "foo": {
      "type": "nested",
      "include_in_root": true,
      "include_in_parent": true,
      "properties": {
        "bar": {
          "type": "nested",
          "include_in_root": true,
          "include_in_parent": true
        }
      }
    }
  }
}

Then foo.bar will copy fields to both the root and parent since parent != root. And then foo will copy fields to its parent, which is the root as well. So fields of foo.bar will end up twice in the root document.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Search/SearchSearch-related issues that do not fall into other categories>bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions