Bug?: nested object mapping won't include both include_in_parent and include_in_root

When I specify a nested object mapping with both include_in_parent and include_in_root it only uses include_in_parent. This feels like a bug. (Elasticsearch version 7.8.0)

Please advise.
- Luke

Test case

PUT bar
{
  "mappings": {
      "properties" : {
        "user" : {
          "type" : "nested",
          "include_in_parent" : true,
          "include_in_root" : true,
          "properties" : {
            "first_name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "last_name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "email": {
              "type" : "nested",
              "include_in_parent" : true,
              "include_in_root" : true,
              "properties" : {
                "username" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                },
                "domain" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                },
                "email" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        }
      }
  }
}

PUT bar/_doc/1
{
  "user": {
    "first_name": "Luke",
    "last_name": "Nezda",
    "email": {
      "username": "luke",
      "domain": "example.com",
      "email": "luke@example.com"
    }
  }
}

GET bar

returns mapping without "include_in_root" : true,. I think this used to work?

{
  "bar" : {
    "aliases" : { },
    "mappings" : {
      "properties" : {
        "user" : {
          "type" : "nested",
          "include_in_parent" : true,
          "properties" : {
            "email" : {
              "type" : "nested",
              "include_in_parent" : true,
              "properties" : {
                "domain" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                },
                "email" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                },
                "username" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "first_name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            },
            "last_name" : {
              "type" : "text",
              "fields" : {
                "keyword" : {
                  "type" : "keyword",
                  "ignore_above" : 256
                }
              }
            }
          }
        }
      }
    },
    "settings" : {
      "index" : {
        "creation_date" : "1597853300876",
        "number_of_shards" : "1",
        "number_of_replicas" : "1",
        "uuid" : "LXSomCE-SZmEv4AT0ZxDiw",
        "version" : {
          "created" : "7080099"
        },
        "provided_name" : "bar"
      }
    }
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.