How to get failed data from request when using BulkProcessor?


#1

Because of request failed,it will enter method (3) and it will lose some data. I want to save these failed data, but get null values. Why? And what should I do? Thx!

BulkProcessor bulkProcessor = BulkProcessor.builder(
client,  
new BulkProcessor.Listener() {
    @Override
    public void beforeBulk(long executionId,
                           BulkRequest request) { ... } (1)

    @Override
    public void afterBulk(long executionId,
                          BulkRequest request,
                          BulkResponse response) { ... } (2)

    @Override
    public void afterBulk(long executionId,
                          BulkRequest request,
                          Throwable failure) { (3)
          List<ActionRequest> list = request.requests();
          System.out.println(list);  (4)
    } 
})
.setBulkActions(10000) 
.setBulkSize(new ByteSizeValue(5, ByteSizeUnit.MB)) 
.setFlushInterval(TimeValue.timeValueSeconds(5)) 
.setConcurrentRequests(1) 
.setBackoffPolicy(
    BackoffPolicy.exponentialBackoff(TimeValue.timeValueMillis(100), 3)) 
.build();

(4)result:

[null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null]

(system) #2

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