本文整理汇总了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));
}
示例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));
}
示例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));
}
示例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));
}
示例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);
}
});
}
示例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));
}