I'm using following technique to copy one field into another in ElasticSearch 7.9.2
localhost:9200/your_index/_update_by_query
{
"query" : {
"match" : {
"product_name": "iphone 9"
}
},
"script" : "ctx._source.company = ctx._source.make;"
}
following error is occurred
"type": "Parsing exception"
"reason": "Unknown key for a Start_Object in [Script]"
I followed these threads Thread 1 Thread 2
CodePudding user response:
Following code executed successfully.
localhost:9200/your_index/_update_by_query
{
"script" : {
"lang": "painless",
"source": "ctx._source.company = ctx._source.make;"
},
"query" : {
"match" : {
"product_name": "iphone 9"
}
}
}