Here is the index structure.
{
"_index": "my_index2",
"_type": "_doc",
"_id": "5",
"_score": 1,
"_source": {
"group": "fans",
"user": [
{
"first": "rayachoty-loki-one",
"last": "Smith"
},
{
"first": "hyderabad-loki-two",
"last": "White"
}
]
}
want to remove objects from user array with last name "White"
I tried with the following query but doesn't help me out.
POST /my_index2/_doc/5/_update{
"script": "Map item_to_remove ;for(item in ctx._source.user){if (item['last'] == params.tweet_id) {item_to_remove=item;}} ctx._source.user.remove(item_to_remove);",
"params": {"tweet_id": "White"}
}