I get Illegal list shortcut value [id].
trying to update this document with this query. What Am I missing
events" : { "type" : "nested" }
location: {"type" : "nested"} nested type of objects
id: {"type" : "text"}
POST event_lists/_update_by_query?conflicts=proceed
{
"script": {
"lang": "painless",
"source": """
for (int i=0; i< ctx._source.events.length; i++){
if(params.event_ids.contains(ctx._source.events[i].id)){
ctx._source.events[i].location = params.location;
break;
}
}
""",
"params": {
"event_ids": ["12345"],
"location": location_object
}
}
}
When trying to use Kibana to debug
Debug.explain(ctx._source.events[i].id);
I get
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"painless_class": "java.lang.String",
"to_string": "ETo3zoABiBlDN0geqAGN",
"java_class": "java.lang.String",
"script_stack": [
"Debug.explain(ctx._source.events[i].id); \n ",
" ^---- HERE"
]
I ended up doing a check if the object is a list vs. an object and it seems to be working.