Updating object field using _reindex API script not working

I am trying to reindex an index and trying to create new field from two object fields.
I am not able to access the field value latitude and it is returning null.

code below
POST _reindex
{
"source": {
"index": "append7"
},
"dest": {
"index": "append8"
},
"script": {
"source": "ctx._source['NEW'] = ctx._source['a.b.latitude'] + ',' + ctx._source['a.b.longitude]",
"lang": "painless"
}
}

My _source shows like this:
"a":{
"b":{
"latitude":"42.00",
"longitude":"74.32"
}

}

Hi,

What's your ES release ?

I am using elastic search 6.3.1 .
I was able to access the field using the below method but don't know why ". " operatror not working on inner object fields.

"script": {
"source": """ctx._source['location_config'] = ctx._source.a.get('Response._latitude')+ ',' + ctx._source.a.get('Response._longitude')""",

"lang": "painless"
}`Preformatted text`

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