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

x33g5p2x  于2022-01-28 转载在 其他  
字(14.3k)|赞(0)|评价(0)|浏览(225)

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

RestHighLevelClient.performRequestAsync介绍

暂无

代码示例

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously executes a request using the Explain API.
 *
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html">Explain API on elastic.co</a>
 * @param explainRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public final void explainAsync(ExplainRequest explainRequest, RequestOptions options, ActionListener<ExplainResponse> listener) {
  performRequestAsync(explainRequest, RequestConverters::explain, options,
    response -> {
      CheckedFunction<XContentParser, ExplainResponse, IOException> entityParser =
        parser -> ExplainResponse.fromXContent(parser, convertExistsResponse(response));
      return parseEntity(response.getEntity(), entityParser);
    },
    listener, singleton(404));
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
 * @param getRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public final void existsAsync(GetRequest getRequest, RequestOptions options, ActionListener<Boolean> listener) {
  performRequestAsync(getRequest, RequestConverters::exists, options, RestHighLevelClient::convertExistsResponse, listener,
      emptySet());
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks for the existence of a document with a "_source" field. Returns true if it exists, false otherwise.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html#_source">Source exists API
 * on elastic.co</a>
 * @param getRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public final void existsSourceAsync(GetRequest getRequest, RequestOptions options, ActionListener<Boolean> listener) {
  performRequestAsync(getRequest, RequestConverters::sourceExists, options, RestHighLevelClient::convertExistsResponse, listener,
      emptySet());
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
 * Indices Aliases API on elastic.co</a>
 * @param getAliasesRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options, ActionListener<Boolean> listener) {
  restHighLevelClient.performRequestAsync(getAliasesRequest, IndicesRequestConverters::existsAlias, options,
      RestHighLevelClient::convertExistsResponse, listener, emptySet());
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Uses the Index Templates API to determine if index templates exist
 *
 * @param indexTemplatesExistRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion. The listener will be called with the value {@code true}
 *                 if any index templates in the request exist, false otherwise
 */
public void existsTemplateAsync(IndexTemplatesExistRequest indexTemplatesExistRequest,
                RequestOptions options,
                ActionListener<Boolean> listener) {
  restHighLevelClient.performRequestAsync(indexTemplatesExistRequest, IndicesRequestConverters::templatesExist, options,
    RestHighLevelClient::convertExistsResponse, listener, emptySet());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
 * Indices Aliases API on elastic.co</a>
 * @param getAliasesRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, RequestOptions options, ActionListener<Boolean> listener) {
  restHighLevelClient.performRequestAsync(getAliasesRequest, IndicesRequestConverters::existsAlias, options,
      RestHighLevelClient::convertExistsResponse, listener, emptySet());
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks for the existence of a document. Returns true if it exists, false otherwise.
 *
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html">Get API on elastic.co</a>
 * @deprecated Prefer {@link #existsAsync(GetRequest, RequestOptions, ActionListener)}
 */
@Deprecated
public final void existsAsync(GetRequest getRequest, ActionListener<Boolean> listener, Header... headers) {
  performRequestAsync(getRequest, RequestConverters::exists, RestHighLevelClient::convertExistsResponse, listener,
      emptySet(), headers);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
 * <p>
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
 * Indices Aliases API on elastic.co</a>
 * @deprecated Prefer {@link #existsAliasAsync(GetAliasesRequest, RequestOptions, ActionListener)}
 */
@Deprecated
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, ActionListener<Boolean> listener, Header... headers) {
  restHighLevelClient.performRequestAsync(getAliasesRequest, IndicesRequestConverters::existsAlias,
      RestHighLevelClient::convertExistsResponse, listener, emptySet(), headers);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks if the index (indices) exists or not.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
 * Indices Exists API on elastic.co</a>
 * @param request the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void existsAsync(GetIndexRequest request, RequestOptions options, ActionListener<Boolean> listener) {
  restHighLevelClient.performRequestAsync(
      request,
      IndicesRequestConverters::indicesExist,
      options,
      RestHighLevelClient::convertExistsResponse,
      listener,
      Collections.emptySet()
  );
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously checks if one or more aliases exist using the Aliases Exist API.
 * <p>
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-aliases.html">
 * Indices Aliases API on elastic.co</a>
 * @deprecated Prefer {@link #existsAliasAsync(GetAliasesRequest, RequestOptions, ActionListener)}
 */
@Deprecated
public void existsAliasAsync(GetAliasesRequest getAliasesRequest, ActionListener<Boolean> listener, Header... headers) {
  restHighLevelClient.performRequestAsync(getAliasesRequest, IndicesRequestConverters::existsAlias,
      RestHighLevelClient::convertExistsResponse, listener, emptySet(), headers);
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously checks if the index (indices) exists or not.
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
 * Indices Exists API on elastic.co</a>
 * @param request the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void existsAsync(GetIndexRequest request, RequestOptions options, ActionListener<Boolean> listener) {
  restHighLevelClient.performRequestAsync(
      request,
      IndicesRequestConverters::indicesExist,
      options,
      RestHighLevelClient::convertExistsResponse,
      listener,
      Collections.emptySet()
  );
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously checks if the index (indices) exists or not.
 * <p>
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
 * Indices Exists API on elastic.co</a>
 * @deprecated Prefer {@link #existsAsync(GetIndexRequest, RequestOptions, ActionListener)}
 */
@Deprecated
public void existsAsync(GetIndexRequest request, ActionListener<Boolean> listener, Header... headers) {
  restHighLevelClient.performRequestAsync(
    request,
    IndicesRequestConverters::indicesExist,
    RestHighLevelClient::convertExistsResponse,
    listener,
    Collections.emptySet(),
    headers
  );
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously checks if the index (indices) exists or not.
 * <p>
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-exists.html">
 * Indices Exists API on elastic.co</a>
 * @deprecated Prefer {@link #existsAsync(GetIndexRequest, RequestOptions, ActionListener)}
 */
@Deprecated
public void existsAsync(GetIndexRequest request, ActionListener<Boolean> listener, Header... headers) {
  restHighLevelClient.performRequestAsync(
    request,
    IndicesRequestConverters::indicesExist,
    RestHighLevelClient::convertExistsResponse,
    listener,
    Collections.emptySet(),
    headers
  );
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

@Deprecated
protected final <Req extends ActionRequest, Resp> void performRequestAsync(Req request,
                              CheckedFunction<Req, Request, IOException> requestConverter,
                              CheckedFunction<Response, Resp, IOException> responseConverter,
                              ActionListener<Resp> listener, Set<Integer> ignores, Header... headers) {
  performRequestAsync(request, requestConverter, optionsForHeaders(headers), responseConverter, listener, ignores);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

@Deprecated
protected final <Req extends ActionRequest, Resp> void performRequestAsyncAndParseEntity(Req request,
                               CheckedFunction<Req, Request, IOException> requestConverter,
                               CheckedFunction<XContentParser, Resp, IOException> entityParser,
                               ActionListener<Resp> listener, Set<Integer> ignores, Header... headers) {
  performRequestAsync(request, requestConverter, (response) -> parseEntity(response.getEntity(), entityParser),
      listener, ignores, headers);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously returns the current license for the cluster cluster.
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void getLicenseAsync(GetLicenseRequest request, RequestOptions options, ActionListener<GetLicenseResponse> listener) {
  restHighLevelClient.performRequestAsync(request, LicenseRequestConverters::getLicense, options,
    response -> new GetLicenseResponse(convertResponseToJson(response)), listener, emptySet());
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Asynchronously returns the current license for the cluster cluster.
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public void getLicenseAsync(GetLicenseRequest request, RequestOptions options, ActionListener<GetLicenseResponse> listener) {
  restHighLevelClient.performRequestAsync(request, LicenseRequestConverters::getLicense, options,
    response -> new GetLicenseResponse(convertResponseToJson(response)), listener, emptySet());
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * @deprecated If creating a new HLRC ReST API call, consider creating new actions instead of reusing server actions. The Validation
 * layer has been added to the ReST client, and requests should extend {@link Validatable} instead of {@link ActionRequest}.
 */
@Deprecated
protected final <Req extends ActionRequest, Resp> void performRequestAsyncAndParseEntity(Req request,
                                   CheckedFunction<Req, Request, IOException> requestConverter,
                                   RequestOptions options,
                                   CheckedFunction<XContentParser, Resp, IOException> entityParser,
                                   ActionListener<Resp> listener, Set<Integer> ignores) {
  performRequestAsync(request, requestConverter, options,
      response -> parseEntity(response.getEntity(), entityParser), listener, ignores);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Defines a helper method for asynchronously performing a request.
 */
protected final <Req extends Validatable, Resp> void performRequestAsyncAndParseEntity(Req request,
                                    CheckedFunction<Req, Request, IOException> requestConverter,
                                    RequestOptions options,
                                    CheckedFunction<XContentParser, Resp, IOException> entityParser,
                                    ActionListener<Resp> listener, Set<Integer> ignores) {
  performRequestAsync(request, requestConverter, options,
    response -> parseEntity(response.getEntity(), entityParser), listener, ignores);
}

代码示例来源:origin: org.elasticsearch.client/elasticsearch-rest-high-level-client

/**
 * Asynchronously executes a request using the Explain API.
 *
 * See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html">Explain API on elastic.co</a>
 * @param explainRequest the request
 * @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
 * @param listener the listener to be notified upon request completion
 */
public final void explainAsync(ExplainRequest explainRequest, RequestOptions options, ActionListener<ExplainResponse> listener) {
  performRequestAsync(explainRequest, RequestConverters::explain, options,
    response -> {
      CheckedFunction<XContentParser, ExplainResponse, IOException> entityParser =
        parser -> ExplainResponse.fromXContent(parser, convertExistsResponse(response));
      return parseEntity(response.getEntity(), entityParser);
    },
    listener, singleton(404));
}

相关文章

微信公众号

最新文章

更多