Java High Rest Client, how to call CLOSE() waiting for ASYNC request

Dear,

How is it possible to wait for ASYNC REQUEST complete before call Close()?

We are using Java High Rest Client.

Our target is to create one instance of RestHighLevelClient, make many ASYNC requests (using indexAsync() method) and close the client.

Actually our issue is that we send many ASYNC request from inside a ForEach and at the end of the ForEach we call the Close() method of the client. Unfortunately it is so fast that no documents will be saved in Elastic index because we call the Close() methods before the requests has been sent to Elastic.

How we should manage this properly?

Why not using the bulk processor instead?

That'd be much more efficient IMO.

Great Idea!

I will try :slight_smile:

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