当前位置: 首页>>代码示例>>Java>>正文


Java Client.execute方法代码示例

本文整理汇总了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));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:18,代码来源:TransportRethrottleAction.java

示例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);
    }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:15,代码来源:BulkByScrollParallelizationHelper.java


注:本文中的org.elasticsearch.client.Client.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。