protected void saveAllNodes(List<Node> nodes) { BulkRequestBuilder bulkRequest = client.prepareBulk(); for (Node node : nodes) { try { ESNode esNode = ESNode.Builder.buildFromEntity(node); bulkRequest.add( client .prepareIndex( indexName, esNode.getEntityType().getIndiceName(), esNode.getIdString()) .setSource(esNode.toJson())); } catch (Exception exception) { LOG.warning( String.format( "Unable to add Entity %s to bulk request, cause: %s", node.getId(), exception.getMessage())); } } executeBulkRequest(bulkRequest); }