Change the mapping from parent child to nested


Currently, I have an index which holds 3 types of documents as described below.
Document_type1 (parent)
Document_type2 (child1 of parent)
Document_type3 (child2 of parent)

Change the parent child relationship to nested document structure. I would like to create a new index with the nested mappings and migrate the data from old_index to new_index (which has nested mapping)

Is this possible ? If, yes what is the better approach.
I looked at elastic reindex feature. Please look at the sample below. This approach just copies all the data to new_index with same parent child relationship instead of merging the documents into nested documents using the new the nested mapping (in new_index).

POST _reindex
"source": {
"index": "old_index"
"dest": {
"index": "new_index"

Is there anything that I missed ?

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