当前位置: 首页>>代码示例>>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;未经允许,请勿转载。