'Elasticsearch multiple nested mapping error

I create an index for Elasticsearch and update mapping for that index, while doing this I use the same mapping as there is because I have reasons for it.

However, for the following situation, an error is returning that I don't understand, am I doing something wrong?

Thanks.

CREATE INDEX (Successful)

PUT /mytestindex
{
  "mappings": {
    "properties": {
      "variable1": {
        "type": "nested",
        "include_in_parent": true,
        "include_in_root": true,
        "properties": {
          "variable2": {
            "type": "double"
          },
          "variable3": {
            "type": "text",
            "fields": {
              "keyword": {
                "type": "keyword"
              }
            }
          },
          "variable4": {
            "type": "double"
          },
          "variable5": {
            "type": "nested",
            "include_in_parent": true,
            "include_in_root": true,
            "properties": {
              "variable6": {
                "type": "text",
                "fields": {
                  "keyword": {
                    "type": "keyword"
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}

UPDATE MAPPING AND RESPONSE


PUT /mytestindex/_mapping
{
  "properties": {
    "variable1": {
      "type": "nested",
      "include_in_parent": true,
      "include_in_root": true,
      "properties": {
        "variable2": {
          "type": "double"
        },
        "variable3": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword"
            }
          }
        },
        "variable4": {
          "type": "double"
        },
        "variable5": {
          "type": "nested",
          "include_in_parent": true,
          "include_in_root": true,
          "properties": {
            "variable6": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword"
                }
              }
            }
          }
        }
      }
    }
  }
}
{
  "error" : {
    "root_cause" : [
      {
        "type" : "mapper_exception",
        "reason" : "the [include_in_root] parameter can't be updated on a nested object mapping"
      }
    ],
    "type" : "mapper_exception",
    "reason" : "the [include_in_root] parameter can't be updated on a nested object mapping"
  },
  "status" : 500
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source