BulkProcessor.awaitClose() is returning false and documents are getting indexed

I am using bulkProcessor to index multiple UpdateRequests. The awaitClose() is returning false and hence the logs of the listener are not printing. The documents are still getting indexed but in the absence of the BulkResponse's logs of the listener, I am not sure whether all the documents got processed or some failed to do so. My question is that what can be the possible reasons awaitClose is returning false. Is there a way it can be true. And how to get the BulkResponse logs in such a scenario.

public static BulkProcessor.Builder getBulkProcessorBuilder(RestHighLevelClient restHighLevelClient) {
        BulkProcessor.Builder builder = BulkProcessor.builder((request, bulkListener) -> {
            try {
                restHighLevelClient.bulk(request, RequestOptions.DEFAULT);
            } catch (IOException e) {
                log.error("Failed to obtain Bulk Response ", e);
            }
        }, getBulkProcessorListener());

        return builder;
    }
public void bulkIndex(List<UpdateRequest> updateRequestList) {
        BulkProcessor bulkProcessor = ElasticSearchBulkProcessorBuilder
                .getBulkProcessorBuilder(restHighLevelClient)
                .build();
        updateRequestList
                .stream()
                .forEach(updateRequest -> bulkProcessor.add(updateRequest));

        try {
            boolean terminated = bulkProcessor.awaitClose(10L, TimeUnit.SECONDS);
            if (!terminated) {
                log.info("Some requests have not been processed. Closing bulkProcessor is timed-out.");
            } else {
                log.info("Closing bulkProcessor is executed successfully");
            }
        } catch (InterruptedException e) {
            log.error("awaitclose failed : ", e);
        }
    }

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