I'm doing the update by query and it's work well on the devtool UI
Screenshot below
But when I did the same thing on linux terminal
curl -X POST -k -u myusername:mypassword "https://localhost:9200/my-index/_update_by_query" -H 'Content-Type: application/json' -d'
{
"script": {
"inline": "ctx._source.field4 = 'New Value'",
"lang": "painless"
},
"query": {
"bool": {
"must": [
{"match": {"field1": "1"}},
{"match": {"field2": "2"}},
{"match": {"field3": "3"}}
]
}
}
}
'
I got this error, looks like a single quote error on the inline attribute? how to fix this one on linux terminal
{
"error": {
"root_cause": [
{
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... _source.field4 = New Value",
" ^---- HERE"
],
"script": "ctx._source.field4 = New Value",
"lang": "painless",
"position": {
"offset": 29,
"start": 4,
"end": 39
}
}
],
"type": "script_exception",
"reason": "compile error",
"script_stack": [
"... _source.field4 = New Value",
" ^---- HERE"
],
"script": "ctx._source.field4 = New Value",
"lang": "painless",
"position": {
"offset": 29,
"start": 4,
"end": 39
},
"caused_by": {
"type": "illegal_argument_exception",
"reason": "cannot resolve symbol [New Value]"
}
},
"status": 400