@Override public BulkNodeClient bulkDelete(DeleteRequest deleteRequest) { if (closed) { throw new ElasticsearchIllegalStateException("client is closed"); } try { if (metric != null) { metric.getCurrentIngest().inc(); } bulkProcessor.add(deleteRequest); } catch (Exception e) { throwable = e; closed = true; logger.error("bulk add of delete failed: " + e.getMessage(), e); } finally { if (metric != null) { metric.getCurrentIngest().dec(); } } return this; }
@Override public BulkNodeClient index(String index, String type, String id, String source) { if (closed) { throw new ElasticsearchIllegalStateException("client is closed"); } try { if (metric != null) { metric.getCurrentIngest().inc(); } bulkProcessor.add(new IndexRequest(index).type(type).id(id).create(false).source(source)); } catch (Exception e) { throwable = e; closed = true; logger.error("bulk add of index request failed: " + e.getMessage(), e); } finally { if (metric != null) { metric.getCurrentIngest().dec(); } } return this; }