Find failed indexquest in bulk load

How to find out which request is failing in bulk load when the id needs to be automatically generated? The request id is still null in the listener's afterBulk method, so can't match to the response.getId(). Not sure what I am missing. If I create the IndexRequest with id, I am able to match them. but I do need the id to be generated.

for (T file : files) {
try {
XContentBuilder source = ...
IndexRequest indexRequest = new IndexRequest(indexName, indexType);
bulkProcessor.add(indexRequest.source(source));
} catch (Exception e) {
logger.error("creating indexRequest", e);
}
}

public void afterBulk(long executionId, BulkRequest request, BulkResponse response) {
for(ActionRequest actionReq: request.requests()){
IndexRequest indReq = (IndexRequest)actionReq;
_logger.info(indReq.id()); -- this id is null, can't match to the id in the response _
}
}
}

They come back in the same order as you send them. Use the index in the
response array.

1 Like

oh... interesting,, didn't find out that.. thank you very much.

In TransportBulkAction.java,
this.allowIdGeneration = this.settings.getAsBoolean("action.bulk.action.allow_id_generation", true);

I am trying the "action.bulk.action.allow_id_generation" and still not work. Thought I am missing something..

Again thank you very much!

Have a nice weekend!