本文整理了Java中org.elasticsearch.client.RestHighLevelClient.delete
方法的一些代码示例,展示了RestHighLevelClient.delete
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RestHighLevelClient.delete
方法的具体详情如下:
包路径:org.elasticsearch.client.RestHighLevelClient
类名称:RestHighLevelClient
方法名:delete
[英]Deletes a document by id using the Delete API. See Delete API on elastic.co
[中]使用Delete API按id删除文档。见Delete API on elastic.co
代码示例来源:origin: Netflix/conductor
@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");
}
}
代码示例来源:origin: spring-projects/spring-data-elasticsearch
@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);
}
}
代码示例来源:origin: tomoya92/pybbs
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());
}
}
代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core
@Override
public DeleteResponse delete(DeleteRequest request) {
try {
return client.delete(request, RequestOptions.DEFAULT);
} catch (IOException e) {
throw new NuxeoException(e);
}
}
代码示例来源:origin: com.wuyushuo/vplus-data
@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);
}
代码示例来源:origin: dqeasycloud/easy-cloud
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 {
代码示例来源:origin: hakdogan/ElasticSearch
/**
*
* @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);
}
}
代码示例来源:origin: DigitalPebble/storm-crawler
@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);
}
代码示例来源:origin: org.apache.camel/camel-elasticsearch-rest
} 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);
代码示例来源:origin: eea/eea.elasticsearch.river.rdf
DeleteResponse deleteResponse = client.delete(deleteRequest);
DeleteResponse deleteResponse = client.delete(deleteRequest);
内容来源于网络,如有侵权,请联系作者删除!