Reindex - Renaming nested fields

Hi,

I am not able to rename a nested field while reindexing

My nested field in the source index:

"nestField" : {
"type" : "nested",
"properties" : {
"fieldOne" : {
"type" : "string",
"store" : true,
"analyzer" : "index_whitespace_lowercase_analyzer",
"search_analyzer" : "search_whitespace_lowercase_analyzer"
},
"fieldTwo" : {
"type" : "string",
"store" : true,
"analyzer" : "index_whitespace_lowercase_analyzer",
"search_analyzer" : "search_whitespace_lowercase_analyzer"
}
}
}

My nested field in the Destination index: (case of the field names converted to lowercase)

"nestfield" : {
"type" : "nested",
"properties" : {
"fieldone" : {
"type" : "string",
"store" : true,
"analyzer" : "index_whitespace_lowercase_analyzer",
"search_analyzer" : "search_whitespace_lowercase_analyzer"
},
"fieldtwo" : {
"type" : "string",
"store" : true,
"analyzer" : "index_whitespace_lowercase_analyzer",
"search_analyzer" : "search_whitespace_lowercase_analyzer"
}
}
}

POST _reindex
{
"size": 1,
"source": {
"index": "src_indx"
},
"dest": {
"index": "tgt_indx"
},
"script": {
"inline": """ctx._source.['nestfield.fieldone'] = ctx._source.("nestField.fieldOne");
ctx._source.['nestfield.fieldtwo'] = ctx._source.("nestField.fieldTwo");
ctx._source.nestfield = ctx._source.nestField]"""
}
}

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