當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。