org.elasticsearch.client.Client.delete()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(312)

本文整理了Java中org.elasticsearch.client.Client.delete()方法的一些代码示例,展示了Client.delete()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Client.delete()方法的具体详情如下:
包路径:org.elasticsearch.client.Client
类名称:Client
方法名:delete

Client.delete介绍

[英]Deletes a document from the index based on the index, type and id.
[中]根据索引、类型和id从索引中删除文档。

代码示例

代码示例来源:origin: Netflix/conductor

@Override
public void removeWorkflow(String workflowId) {
  try {
    DeleteRequest request = new DeleteRequest(indexName, WORKFLOW_DOC_TYPE, workflowId);
    DeleteResponse response = elasticSearchClient.delete(request).actionGet();
    if (response.getResult() == DocWriteResponse.Result.DELETED) {
      logger.error("Index removal failed - document not found by id: {}", workflowId);
    }
  } catch (Exception e) {
    logger.error("Failed to remove workflow {} from index", workflowId, e);
    Monitors.error(className, "remove");
  }
}

代码示例来源:origin: javanna/elasticshell

@Override
protected ActionFuture<DeleteResponse> doExecute(DeleteRequest request) {
  return client.delete(request);
}

代码示例来源:origin: org.nuxeo.elasticsearch/nuxeo-elasticsearch-core

@Override
public DeleteResponse delete(DeleteRequest request) {
  return client.delete(request).actionGet();
}

代码示例来源:origin: com.github.tlrx/elasticsearch-test

@Override
public Void execute(final Client client) throws ElasticsearchException {
  try {
    DeleteResponse response = client.delete(request).get();
  } catch (Exception e) {
    throw new EsSetupRuntimeException(e);
  }
  return null;
}

代码示例来源:origin: tlrx/elasticsearch-test

@Override
public Void execute(final Client client) throws ElasticsearchException {
  try {
    DeleteResponse response = client.delete(request).get();
  } catch (Exception e) {
    throw new EsSetupRuntimeException(e);
  }
  return null;
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch2

@Override
public void deleteElement(Graph graph, Element element, Authorizations authorizations) {
  deleteExtendedDataForElement(element);
  String indexName = getIndexName(element);
  String id = element.getId();
  if (MUTATION_LOGGER.isTraceEnabled()) {
    LOGGER.trace("deleting document %s", id);
  }
  getClient().delete(
      getClient()
          .prepareDelete(indexName, ELEMENT_TYPE, id)
          .request()
  ).actionGet();
}

代码示例来源:origin: harbby/presto-connectors

public void deleteScriptFromIndex(DeleteIndexedScriptRequest request, ActionListener<DeleteResponse> listener) {
  String scriptLang = validateScriptLanguage(request.scriptLang());
  DeleteRequest deleteRequest = new DeleteRequest(request).index(SCRIPT_INDEX).type(scriptLang).id(request.id())
      .refresh(true).version(request.version()).versionType(request.versionType());
  client.delete(deleteRequest, listener);
}

代码示例来源:origin: org.vertexium/vertexium-elasticsearch5

@Override
public void deleteElement(Graph graph, Element element, Authorizations authorizations) {
  deleteExtendedDataForElement(element);
  String indexName = getIndexName(element);
  String docId = getIdStrategy().createElementDocId(element);
  if (MUTATION_LOGGER.isTraceEnabled()) {
    LOGGER.trace("deleting document %s (docId: %s)", element.getId(), docId);
  }
  getIndexRefreshTracker().pushChange(indexName);
  getClient().delete(
      getClient()
          .prepareDelete(indexName, getIdStrategy().getType(), docId)
          .request()
  ).actionGet();
}

代码示例来源:origin: visallo/vertexium

@Override
public void deleteElement(Graph graph, Element element, Authorizations authorizations) {
  deleteExtendedDataForElement(element);
  String indexName = getIndexName(element);
  String docId = getIdStrategy().createElementDocId(element);
  if (MUTATION_LOGGER.isTraceEnabled()) {
    LOGGER.trace("deleting document %s (docId: %s)", element.getId(), docId);
  }
  getIndexRefreshTracker().pushChange(indexName);
  getClient().delete(
      getClient()
          .prepareDelete(indexName, getIdStrategy().getType(), docId)
          .request()
  ).actionGet();
}

代码示例来源:origin: harbby/presto-connectors

client.delete(deleteRequest, new RestBuilderListener<DeleteResponse>(channel) {
  @Override
  public RestResponse buildResponse(DeleteResponse result, XContentBuilder builder) throws Exception {

相关文章