for (int i = 0; i < _tasks.length; i++) {
_tasks[i].resolveEntity(entityResolver);
}
}
BulkResponseWrapper response = executor.getTaskProcessor().getIndex()
.executeBulk(new Esi4JOperation<ListenableActionFuture<BulkResponse>>() {
@Override
public ListenableActionFuture<BulkResponse> execute(Client client, String indexName,
OperationContext helper) {
BulkRequestBuilder bulk = client.prepareBulk();
for (int i = 0; i < _tasks.length; i++) {
_tasks[i].addToBulk(bulk, indexName, helper);
}
ListenableActionFuture<BulkResponse> response = bulk.execute();
return response;
}
}).actionGet();
int failed = 0;
for (BulkItemResponse item : response.getBulkResponse()) {
if (item.isFailed()) {
failed++;
}
}
if (failed > 0) {
log.warn("failed to index " + failed + " items. index might be out of sync");
}
if (log.isDebugEnabled()) {
int indexed = response.getBulkResponse().getItems().length - failed;
log.debug("finished bulk indexing " + indexed + " items");
}
}