Conditional update in Elasticsearch: "Invalid op [none]"


#1

Elasticsearch 2.3. I am firing this query to update every doc in an index based on a condition.

{
"query": {
  "bool": {
     "must": [
        {
          "match_all": {}
        }]}},
  "script" : 
  { 
     "inline" : "if (ctx._source.url.endsWith('a=6')) ctx.op = 'none' else ctx._source.url = ctx._source.url + '&b=3'"
  }
}

As stated here, I am using ctx.op = 'none' to avoid updating the docs that do not match the condition.

I am getting

Invalid op [none]

Full error:

"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": "Invalid op [none]"
}
],
"type": "illegal_argument_exception",
"reason": "Invalid op [none]"
},
"status": 400

Seems to be so simple that I am pretty lost. Thanks for your help.


#2

The correct operation is noop, not none. The docs seems to be outdated.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.