_update_by_query with ES 2.1

I need to apply a fix to the content of various documents in ES 2.1 (bug in the code we urgently need to fix).
We have ~400 M documents in ES 2.1

The following request works perfectly in ES 6:

POST messages/_update_by_query
{
"script": {
"source": "ctx._source.item.amountEuro=(Math.round(100.0*ctx._source.item.amountNational/ctx._source.item.conversionRate))/100.0",
"lang": "painless"
},
"query": {
"term": {
"country": "HR"
}
}
}

In ES 2.1, I have a type: "sdr"

Therefore, I tried running the very same request, simply adding the type as follows:

POST messages/sdr/_udpate_by_query
...

but this does not work (at least nothing is performed at the level of the documents).

What am I doing wrong?

Many thanks for your help.

Painless was not supported till ES 5.0

Reference: link

You will have to rewrite your current script to a Groovy script. As explained here

Good luck with fixing your issue!

Ohh now that I think of it, update_by_query api was not implemented until version 2.3..

Don't tell me that :frowning:

Therefore I need to make a dedicated development to solve this... oh no...

Thanks for your answer.

Sorry man :cry: wish I could be of more help

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