private void flushBulkRequests() {
        bulkRequests.entrySet().stream()
                .filter(
                        entry ->
                                (System.currentTimeMillis() - entry.getValue().getLastFlushTime())
                                        >= asyncBufferFlushTimeout)
                .filter(
                        entry ->
                                entry.getValue().getBulkRequestBuilder() != null
                                        && entry.getValue()
                                                        .getBulkRequestBuilder()
                                                        .numberOfActions()
                                                > 0)
                .forEach(
                        entry -> {
                            LOGGER.debug(
                                    "Flushing bulk request buffer for type {}, size: {}",
                                    entry.getKey(),
                                    entry.getValue().getBulkRequestBuilder().numberOfActions());
                            indexBulkRequest(entry.getKey());
                        });
    }
Flush the buffers if bulk requests have not been indexed for the past {@link
ElasticSearchProperties#getAsyncBufferFlushTimeout()} seconds. This is to prevent data loss
in case the instance is terminated, while the buffer still holds documents to be indexed.
es6-persistence/src/main/java/com/netflix/conductor/es6/dao/index/ElasticSearchDAOV6.java