How to execute BULK UpdateByQuery using java api - Elasticsearch 5.x


(Abed) #1

I have multiple updateByQuery requests, and looking for a way to group them together, and then execute (for performance reasons).

Example:

QueryByField || field11111 || field222222 || field333333 ||

xxxxxxxxxxxx || newValue || newValueee || newValuee ||

yyyyyyyyyyyyy || newValue || newValueee || newValuee ||

zzzzzzzzzzzzzz || newValue || newValueee || newValuee ||

As of now, seems like I'll have to do the following query for each one of lines above:

UpdateByQueryRequestBuilder updateByQueryRequestBuilder = UpdateByQueryAction.INSTANCE.newRequestBuilder(client);
updateByQueryRequestBuilder
.source("myIndexName")
.filter(QueryBuilders.matchQuery("QueryByField","xxxxxxxxxxxx"))
.script(new Script("ctx._source.field11111 = "newValue""))
.get();

But I was wondering, is there something similar to what we do with UpdateRequest & BulkRequestBuilder that can be used for UpdateByQuery?


(system) #2

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