We had the following line of Groovy script in 5.X:
"inline":"ctx._source.all_phone.removeAll{it.phone_number == params.remove_id}
It throws the following error in 6.3.0:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... ource.all_phone.removeAll{it.phone_number == param ...",
" ^---- HERE"
],
"script": "ctx._source.all_phone.removeAll{it.phone_number == params.remove_id}",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... ource.all_phone.removeAll{it.phone_number == param ...",
" ^---- HERE"
],
"script": "ctx._source.all_phone.removeAll{it.phone_number == params.remove_id}",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "invalid sequence of tokens near ['{'].",
"caused_by": {
"type": "no_viable_alt_exception",
"reason": null
}
}
},
"status": 500
}
What I want to do is: remove elements from a nested field which match a given criteria.