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
POST http://127.0.0.1:9200/order/_update/1
{
"script" : {
"source": "def aVar = \"doNothing\";",
"lang": "painless"
},
"upsert" : {
"orderNo":"1234",
"clients" : [
{"clientId":"p1","firstName":"john","lastName":"doe"},
{"clientId":"p2","firstName":"will","lastName":"smith"}
]
}
}