本文整理汇总了Java中org.elasticsearch.client.Client.execute方法的典型用法代码示例。如果您正苦于以下问题:Java Client.execute方法的具体用法?Java Client.execute怎么用?Java Client.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.elasticsearch.client.Client
的用法示例。
在下文中一共展示了Client.execute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rethrottle
import org.elasticsearch.client.Client; //导入方法依赖的package包/类
static void rethrottle(String localNodeId, Client client, BulkByScrollTask task, float newRequestsPerSecond,
ActionListener<TaskInfo> listener) {
int runningSubTasks = task.runningSliceSubTasks();
if (runningSubTasks == 0) {
// Nothing to do, all sub tasks are done
task.rethrottle(newRequestsPerSecond);
listener.onResponse(task.taskInfo(localNodeId, true));
return;
}
RethrottleRequest subRequest = new RethrottleRequest();
subRequest.setRequestsPerSecond(newRequestsPerSecond / runningSubTasks);
subRequest.setParentTaskId(new TaskId(localNodeId, task.getId()));
client.execute(RethrottleAction.INSTANCE, subRequest, ActionListener.wrap(r -> {
r.rethrowFailures("Rethrottle");
listener.onResponse(task.getInfoGivenSliceInfo(localNodeId, r.getTasks()));
}, listener::onFailure));
}
示例2: startSlices
import org.elasticsearch.client.Client; //导入方法依赖的package包/类
public static <
Request extends AbstractBulkByScrollRequest<Request>
> void startSlices(Client client, TaskManager taskManager, Action<Request, BulkByScrollResponse, ?> action,
String localNodeId, ParentBulkByScrollTask task, Request request, ActionListener<BulkByScrollResponse> listener) {
TaskId parentTaskId = new TaskId(localNodeId, task.getId());
for (final SearchRequest slice : sliceIntoSubRequests(request.getSearchRequest(), UidFieldMapper.NAME, request.getSlices())) {
// TODO move the request to the correct node. maybe here or somehow do it as part of startup for reindex in general....
Request requestForSlice = request.forSlice(parentTaskId, slice);
ActionListener<BulkByScrollResponse> sliceListener = ActionListener.wrap(
r -> task.onSliceResponse(listener, slice.source().slice().getId(), r),
e -> task.onSliceFailure(listener, slice.source().slice().getId(), e));
client.execute(action, requestForSlice, sliceListener);
}
}