0

I want to run an update-by-query call on Elasticsearch. I wrote the code to execute as follows and it works,

UpdateByQueryRequestBuilder builder = buildUpdateByQueryRequestBuilder();
builder.get();

However, during the code review someone told me to, instead of calling get() on the builder to use UpdateByQueryRequest class by invoking builder.request() which sorta makes sense.

But the issue is, I don't know how to execute a UpdateByQueryRequest. I looked at the online documentation but there doesn't seem to be any documentation on it.

So is UpdateByQueryRequestBuilder#get() the way to go or could an UpdateByQueryRequest be actually be invoked?

Thanks in advance.

1 Answer 1

2

invoke builder.get() directly, this is a block execute, you can use execute with ActionListener async execute.

maybe you can do it like:

builder.execute(new ActionListner<BulkIndexByScrollResponse> {
   void onResponse(Response response) {
   // do something
   }
   void onFailure(Exception e) {
   // do something
   }
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.