Update using script for entire index


(Ashish Nigam-2) #1

Hi,
I am trying to perform simple update via this call -

curl -XPOST 'localhost:9200/testindex_2/eventsummarydata/_update' -d '{
"script" : "ctx._source.cspId == 9700 ? ctx._source.cspId = 97 : ctx.op = "none""
}'

My goal is to update an integer field if its value is 9700 to a new value of 97. This call does not work till I specify id of the document.
So this call will work -

curl -XPOST 'localhost:9200/testindex_2/eventsummarydata/10999/_update' -d '{
"script" : "ctx._source.cspId == 9700 ? ctx._source.cspId = 97 : ctx.op = "none""
}'

Is it not possible to update all documents within an index without providing explicit id?
If there is, please let me know the right way.

Thanks
Ashish


(system) #2