List<JresBulkItemResult> results = Lists.newArrayList(bulkReply.getResults());
assert futures.size() == results.size();
for (int i = 0; i < results.size(); i++) {
SettableFuture<JresBulkItemResult> future = futures.get(i);
JresBulkItemResult result = results.get(i);
if (result.getResult().hasError()) {
future.setException(new RuntimeException(result.getResult().getError()));
} else {
future.set(result);
}
}