I recently bumped into this, but my solution was a little different.
I believe the ElasticSearch documentation here concerning scripting with reindex might be incorrect, or at least it did not work for me.
Instead of using source in the following:
"script": {
"source": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
"lang": "painless"
}
I had to use inline:
"script": {
"inline": "if (ctx._source.foo == 'bar') {ctx._version++; ctx._source.remove('foo')}",
"lang": "painless"
}
And then, worked like a charm. Checked with raw HTTP requests and python ElasticSearch client. This was on ElasticSearch version 5.5.1.
sourceinscripttoinline. see this: qbox.io/blog/…