# Change existing field to nested field in index mappinfg

**URL:** <https://discuss.elastic.co/t/change-existing-field-to-nested-field-in-index-mappinfg/309090>\
**Category:** Elasticsearch\
**Created:** [July 7, 2022, 8:57am UTC](https://discuss.elastic.co/t/change-existing-field-to-nested-field-in-index-mappinfg/309090 "2022-07-07T08:57:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anand\_tripathi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anand_tripathi/32/107286_2.png) [@anand\_tripathi](https://discuss.elastic.co/u/anand_tripathi)\
**Post date:** [July 7, 2022, 8:57am UTC](https://discuss.elastic.co/t/change-existing-field-to-nested-field-in-index-mappinfg/309090/1 "2022-07-07T08:57:31Z")

</div>

Hi Everyone,  
I have an existing index with the mapping below

```auto
{
  "family": {
    "mappings": {
      "properties": {
        "@timestamp": {
          "type": "date"
        },
        "@version": {
          "type": "text",
          "fields": {
            "keyword": {
              "type": "keyword",
              "ignore_above": 256
            }
          }
        },
        "family_id": {
          "type": "long"
        },
        ...
        "representative": {
          "properties": {
            "abstract": { # ----------------> this needs to be nested field
              "properties": {
                "abstract": {
                  "type": "text",
                  "fields": {
                    "keyword": {
                      "type": "keyword",
                      "ignore_above": 256
                    }
                  }
                },
                "lang": {
                  "type": "text",
                  "fields": {
                    "keyword": {
                      "type": "keyword",
                      "ignore_above": 256
                    }
                  }
                }
              }
            },
            "applicant": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            },
            "claims": { # ---------------> this needs to be nested
              "properties": {
                "claim": {
                  "type": "text",
                  "fields": {
                    "keyword": {
                      "type": "keyword",
                      "ignore_above": 256
                    }
                  }
                },
                "lang": {
                  "type": "text",
                  "fields": {
                    "keyword": {
                      "type": "keyword",
                      "ignore_above": 256
                    }
                  }
                }
              }
            },
            "country": {
              "type": "text",
              "fields": {
                "keyword": {
                  "type": "keyword",
                  "ignore_above": 256
                }
              }
            }
          }
        }
      }
    }
  }
}

```

In the above mapping I need to change the field type of representative.claims and representative.abstract from a normal field to a nested field. Is it possible without repopulating the whole index

---

<div class="post-metadata">

**Author:** ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)\
**Post date:** [July 7, 2022, 2:10pm UTC](https://discuss.elastic.co/t/change-existing-field-to-nested-field-in-index-mappinfg/309090/2 "2022-07-07T14:10:30Z")

</div>

Hi @anand_tripathi

To make the field nested you will need reindex.  
1 - create the new index  
2 - reindex data.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 4, 2022, 2:10pm UTC](https://discuss.elastic.co/t/change-existing-field-to-nested-field-in-index-mappinfg/309090/3 "2022-08-04T14:10:41Z")

</div>

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