This is my document
{
"name": "andrew",
"b": [{"x":"c1", "y": 0}, {"x":"c2", "y": 0}]
}
I want to find element in the array field "b" and update the entire object. I tried this script but it does not update. Any ideas?
{
"script": "for (item in ctx._source.b) { if (item['x'] == x_id) { item = newobj; } };",
"params": {
"x_id": "c1",
"newobj" : {"x":"c1", "y": 4222}
},
"lang":"groovy"
}