@Override public void removeWorkflow(String workflowId) { DeleteRequest request = new DeleteRequest(indexName, WORKFLOW_DOC_TYPE, workflowId); try { DeleteResponse response = elasticSearchClient.delete(request); if (response.getResult() == DocWriteResponse.Result.NOT_FOUND) { logger.error("Index removal failed - document not found by id: {}", workflowId); } } catch (IOException e) { logger.error("Failed to remove workflow {} from index", workflowId, e); Monitors.error(className, "remove"); } }
@Override public String delete(String indexName, String type, String id) { DeleteRequest request = new DeleteRequest(indexName, type, id); try { return client.delete(request).getId(); } catch (IOException e) { throw new ElasticsearchException("Error while deleting item request: " + request.toString(), e); } }
public void deleteDocument(String type, String id) { try { if (this.instance() == null) return; DeleteRequest request = new DeleteRequest(name, type, id); client.delete(request, RequestOptions.DEFAULT); } catch (IOException e) { log.error(e.getMessage()); } }
@Override public DeleteResponse delete(DeleteRequest request) { try { return client.delete(request, RequestOptions.DEFAULT); } catch (IOException e) { throw new NuxeoException(e); } }
@Override public DeleteResponse deleteIndex(String index, String type, String id) throws Exception { DeleteRequest request = new DeleteRequest(index, type, id); log.debug(request.toString()); return client().delete(request); }
public boolean delete(String indexName, String type, String id) throws IOException { try { DeleteRequest request = new DeleteRequest("posts", "doc", "1").version(2); DeleteResponse deleteResponse = client.delete(request); return deleteResponse.isFragment(); } catch (ElasticsearchException exception) { if (exception.status() == RestStatus.NOT_FOUND) { } } return false; } public UpdateResponse update(String indexName, String type, String id) throws IOException {
/** * * @param id * @throws IOException */ public void deleteDocument(String id){ try { DeleteRequest deleteRequest = new DeleteRequest(props.getIndex().getName(), props.getIndex().getType(), id); client.delete(deleteRequest); } catch (Exception ex){ log.error("The exception was thrown in deleteDocument method. {} ", ex); } }
@Override public void execute(Tuple tuple) { String url = tuple.getStringByField("url"); Metadata metadata = (Metadata) tuple.getValueByField("metadata"); // keep it simple for now and ignore cases where the canonical URL was // used String sha256hex = org.apache.commons.codec.digest.DigestUtils .sha256Hex(url); DeleteRequest dr = new DeleteRequest(getIndexName(metadata), docType, sha256hex); try { client.delete(dr); } catch (IOException e) { _collector.fail(tuple); LOG.error("Exception caught while deleting", e); return; } _collector.ack(tuple); }
} else if (operation == ElasticsearchOperation.Delete) { DeleteRequest deleteRequest = message.getBody(DeleteRequest.class); message.setBody(restHighLevelClient.delete(deleteRequest, RequestOptions.DEFAULT).getResult()); } else if (operation == ElasticsearchOperation.DeleteIndex) { DeleteRequest deleteRequest = message.getBody(DeleteRequest.class);