private boolean isBulkProcessorAvailable() {
NodesStatsResponse response = client.admin().cluster().prepareNodesStats().setThreadPool(true).get();
for (NodeStats nodeStats : response.getNodes()) {
Iterator<Stats> iterator = nodeStats.getThreadPool().iterator();
while (iterator.hasNext()) {
Stats stats = iterator.next();
if ("bulk".equals(stats.getName())) {
int queue = stats.getQueue();
logger.trace("bulkQueueSize [{}] - queue [{}] - availability [{}]", bulkQueueSize, queue, 1 - (queue / bulkQueueSize));
return 1 - (queue / bulkQueueSize) > 0.1;
}
}
}