Script update : NOOP when script does not modify document?

I need to update a large number of documents. Technically this update (should) generate a lot of noops.

The script checks a condition on the _source, and only modify the _source under certain conditions. I cannot check this condition in the query, as the value I am checking is only contained in the source.

It seems that an update "by script" always result in an update, regardless if the script updates the "_source" or not.

After observing this, I tried a little test I have used a script that does nothing, but I can see the "version" of my doc going up.

Is this normal?
Using V.76.0

    "script" : {
    "source": "def aVar = \"doNothing\";",
     "lang": "painless"
    "upsert" : {
	    "clients" : [


You can control this in the script execution by yourself, by setting

ctx.op = 'noop'

hope this helps!


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