if (bulk.numberOfActions() > 0) {
LOG.info("Executing {} bulk actions", bulk.numberOfActions());
final BulkResponse bulkResponse = bulk.execute().actionGet();
if (bulkResponse.hasFailures()) {
LOG.error("BULK ERROR {}", bulkResponse.buildFailureMessage());
} else {
LOG.info("Bulk action took {}ms", bulkResponse.getTookInMillis());
}
} else {
LOG.debug("No bulk actions to execute!");