當前位置: 首頁>>代碼示例>>Java>>正文


Java NodeClient.execute方法代碼示例

本文整理匯總了Java中org.elasticsearch.client.node.NodeClient.execute方法的典型用法代碼示例。如果您正苦於以下問題:Java NodeClient.execute方法的具體用法?Java NodeClient.execute怎麽用?Java NodeClient.execute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.elasticsearch.client.node.NodeClient的用法示例。


在下文中一共展示了NodeClient.execute方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    if (request.hasContentOrSourceParam() == false) {
        throw new ElasticsearchException("request body is required");
    }

    // Creates the search request with all required params
    SearchRequest searchRequest = new SearchRequest();
    RestSearchAction.parseSearchRequest(searchRequest, request, null);

    // Creates the search template request
    SearchTemplateRequest searchTemplateRequest;
    try (XContentParser parser = request.contentOrSourceParamParser()) {
        searchTemplateRequest = PARSER.parse(parser, new SearchTemplateRequest(), null);
    }
    searchTemplateRequest.setRequest(searchRequest);

    return channel -> client.execute(SearchTemplateAction.INSTANCE, searchTemplateRequest, new RestStatusToXContentListener<>(channel));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:20,代碼來源:RestSearchTemplateAction.java

示例2: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    // Creates the render template request
    SearchTemplateRequest renderRequest;
    try (XContentParser parser = request.contentOrSourceParamParser()) {
        renderRequest = RestSearchTemplateAction.parse(parser);
    }
    renderRequest.setSimulate(true);

    String id = request.param("id");
    if (id != null) {
        renderRequest.setScriptType(ScriptType.STORED);
        renderRequest.setScript(id);
    }

    return channel -> client.execute(SearchTemplateAction.INSTANCE, renderRequest, new RestToXContentListener<>(channel));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:18,代碼來源:RestRenderSearchTemplateAction.java

示例3: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
    if (request.hasContentOrSourceParam() == false) {
        throw new ElasticsearchException("request body is required");
    }

    MultiSearchTemplateRequest multiRequest = parseRequest(request, allowExplicitIndex);
    return channel -> client.execute(MultiSearchTemplateAction.INSTANCE, multiRequest, new RestToXContentListener<>(channel));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:10,代碼來源:RestMultiSearchTemplateAction.java

示例4: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    RethrottleRequest internalRequest = new RethrottleRequest();
    internalRequest.setTaskId(new TaskId(request.param("taskId")));
    Float requestsPerSecond = AbstractBaseReindexRestHandler.parseRequestsPerSecond(request);
    if (requestsPerSecond == null) {
        throw new IllegalArgumentException("requests_per_second is a required parameter");
    }
    internalRequest.setRequestsPerSecond(requestsPerSecond);
    final String groupBy = request.param("group_by", "nodes");
    return channel ->
        client.execute(RethrottleAction.INSTANCE, internalRequest, listTasksResponseListener(nodesInCluster, groupBy, channel));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:14,代碼來源:RestRethrottleAction.java

示例5: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    return channel -> client.execute(MainAction.INSTANCE, new MainRequest(), new RestBuilderListener<MainResponse>(channel) {
        @Override
        public RestResponse buildResponse(MainResponse mainResponse, XContentBuilder builder) throws Exception {
            return convertMainResponse(mainResponse, request, builder);
        }
    });
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:10,代碼來源:RestMainAction.java

示例6: prepareRequest

import org.elasticsearch.client.node.NodeClient; //導入方法依賴的package包/類
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    SearchRequest searchRequest = new SearchRequest();
    return channel -> client.execute(NoopSearchAction.INSTANCE, searchRequest, new RestStatusToXContentListener<>(channel));
}
 
開發者ID:justor,項目名稱:elasticsearch_my,代碼行數:6,代碼來源:RestNoopSearchAction.java


注:本文中的org.elasticsearch.client.node.NodeClient.execute方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。