我有一个要更新的字段,其中有空格。
POST /index/type/_update_by_query
{
"query": {
"match_phrase":{
"field": "value"
}
},
"script":{
"lang": "painless",
"inline": "ctx._source.Existing Field = New_Value"
}
}
但是我收到了这个错误。
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"ctx._source.Existing Field = New_Value",
" ^---- HERE"
],
"script": "ctx._source.Existing Field = New_Value",
"lang": "painless"
}
],
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"ctx._source.Existing Field = New_Value",
" ^---- HERE"
],
"script": "ctx._source.Existing Field = New_Value",
"lang": "painless",
"caused_by": {
"type": "illegal_argument_exception",
"reason": "unexpected token ['Field'] was expecting one of [{<EOF>, ';'}]."
}
},
"status": 500
}
当我在没有空间的字段上执行此查询时,它可以正常工作。 如何处理字段名称中有空格的情况?
ELK版本= 5.4.3 我在文档中读到不建议在字段名中使用空格,但是这些字段是从某个服务器动态创建的,每天都有1M个数据条目。因此,我想对所有匹配的条目执行update_by_query。