private void deleteBulkRequestDocuments(final ElasticsearchClient elasticClient,
                                            final BulkResponse response) {
        final List<BulkOperation> deleteOperations = new ArrayList<>();

        for (final BulkResponseItem item : response.items()) {
            if (item.error() == null) {
                deleteOperations.add(BulkOperation.of(b -> b
                        .delete(deleteOp -> deleteOp
                                .index(item.index())
                                .id(item.id())
                        )
                ));
            }
        }

        if (!deleteOperations.isEmpty()) {
            try {
                final BulkRequest bulkRequest = new BulkRequest.Builder()
                        .operations(deleteOperations)
                        .build();

                elasticClient.bulk(bulkRequest);

                LOGGER.info("Deleted {} documents from failed bulk indexing request for stream {}, pipeline '{}'",
                        deleteOperations.size(), metaHolder.getMeta().getId(), pipelineName);
            } catch (IOException e) {
                LOGGER.warn("Error occurred when deleting documents indexed during a failed bulk request. " +
                            "Stream: {}, pipeline: '{}'", metaHolder.getMeta().getId(), pipelineName, e);
            }
        }
    }
Delete any documents that were successfully indexed during a failed bulk request.
This removes duplicates in the destination index.
stroom-search/stroom-search-elastic/src/main/java/stroom/search/elastic/indexing/ElasticIndexingFilter.java