Elasticsearch Java API async/sync calls timeout issue

Hi all!

I have a question regarding some king of locking in ES (Java API). There should be one async call that start a process and send a response to user that process is in on progress, but all other method can be not async, because code are not overloaded by listeners for all async calls. Anyways, I faced with next problem: I make async call to create a new index. In responce handler I called another method to add some documents (10 documents) to this index (this call is not an async one), but I always get ava.io.IOException: listener timeout after waiting for [90000] ms . But document actually were added... Also I noticed that if all the calls are async - there is not such problem.The same situation when all call are NOT async.

Elasticsearch version - 7.7.0

How it could be solved?

Here is a short example of a structure:

Summary
private void createIndex() throws IOException {
    ...
    restHighLevelClient.indices().createAsync(request, RequestOptions.DEFAULT, createIndexListener);
    ...
}


ActionListener<CreateIndexResponse> createIndexListener = new ActionListener<CreateIndexResponse>() {

    @Override
    public void onResponse(CreateIndexResponse createIndexResponse) 
        startProcess(createIndexResponse.index());
    }

    @Override
    public void onFailure(Exception e) {
      ...
    }
};


private void startProcess(){
    ...
    BulkRequest request = prepareBulkRequest(new BulkRequest(), newIndexName, preparedDocuments);
    BulkResponse bulk = restHighLevelClient.bulk(request, RequestOptions.DEFAULT);  <---- and this call returns an IOException.
    ...
}

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