我是 ElasticSearch 的新手,我是否正在尝试使用 _update_by_query 路由。我正在发送这个身体:
{
"query": {
"match": {
"id": "fdfsfsfs-058f-437d-bc52-473808ba61c2"
}
},
"script": {
"inline": "ctx._source.addresses.add(params.data)",
"params": {
"data": {
"street": "Road",
"number": 15,
"county": "WWW"
}
}
}
}
但我得到以下回复:
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.addresses.add(params.data)",
" ^---- HERE"
],
"script": "ctx._source.addresses.add(params.data)",
"lang": "painless",
"position": {
"offset": 30,
"start": 0,
"end": 36
}
}
],
"type": "script_exception",
"reason": "runtime error",
"script_stack": [
"ctx._source.addresses.add(params.data)",
" ^---- HERE"
],
"script": "ctx._source.addresses.add(params.data)",
"lang": "painless",
"position": {
"offset": 30,
"start": 0,
"end": 36
},
"caused_by": {
"type": "null_pointer_exception",
"reason": null
}
},
"status": 400
}
我不知道可能是什么错误,因为我确实传递了我的参数并且它们在“脚本”对象中。有谁知道可能出了什么问题?
非常感谢您!