Change existing field to nested field in index mappinfg

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

{
  "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

Hi @anand_tripathi

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

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