Return a CompletableFuture from BulkIngester.flush method#806
Return a CompletableFuture from BulkIngester.flush method#806aidin36 wants to merge 1 commit intoelastic:mainfrom
Conversation
|
💚 CLA has been signed |
7216ae1 to
e765121
Compare
|
Hello! Before changing the code, have you tried the |
|
Hi (: Besides my use case, I believe it's a good idea to return a Future from all the async methods and allow the client to know what happened to the result of the call. |
|
Hi, I also think that this change is really necessary as it is resolving also our use case as well. For us it is important that flush will wait untill afterBulk will be called, so with this change we would simply wait for flush to finish. |
|
I think this relates to #703 |
The Issue
In one case in our production app, we want to
flushthe bulk operations and make them immediately available for search. So, we do aflushon ourBulkIngesterinstance, then we do aclient.indices().refresh(). However, because theflushoperation is asynchronous, most of the time before all the operations flush, therefreshgets called. So, some of the changes aren't immediately available for search.The Solution
I returned a
CompletableFuturefrom theflushmethod, so the user can wait for theflushto finish if required.Documents
Sorry, I couldn't find where's the document for the
flushmethod so I could update it. If you point me to it, I can update the return type there.gradlew check
There are nine failing tests. But they were failing before my changes too.