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


Java ClusterHealthRequest.waitForActiveShards方法代码示例

本文整理汇总了Java中org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest.waitForActiveShards方法的典型用法代码示例。如果您正苦于以下问题:Java ClusterHealthRequest.waitForActiveShards方法的具体用法?Java ClusterHealthRequest.waitForActiveShards怎么用?Java ClusterHealthRequest.waitForActiveShards使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest的用法示例。


在下文中一共展示了ClusterHealthRequest.waitForActiveShards方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareRequest

import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; //导入方法依赖的package包/类
@Override
public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException {
    ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index")));
    clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
    clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
    clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout()));
    String waitForStatus = request.param("wait_for_status");
    if (waitForStatus != null) {
        clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT)));
    }
    clusterHealthRequest.waitForNoRelocatingShards(
            request.paramAsBoolean("wait_for_no_relocating_shards", clusterHealthRequest.waitForNoRelocatingShards()));
    if (request.hasParam("wait_for_relocating_shards")) {
        // wait_for_relocating_shards has been removed in favor of wait_for_no_relocating_shards
        throw new IllegalArgumentException("wait_for_relocating_shards has been removed, " +
                                           "use wait_for_no_relocating_shards [true/false] instead");
    }
    String waitForActiveShards = request.param("wait_for_active_shards");
    if (waitForActiveShards != null) {
        clusterHealthRequest.waitForActiveShards(ActiveShardCount.parseString(waitForActiveShards));
    }
    clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes()));
    if (request.param("wait_for_events") != null) {
        clusterHealthRequest.waitForEvents(Priority.valueOf(request.param("wait_for_events").toUpperCase(Locale.ROOT)));
    }
    return channel -> client.admin().cluster().health(clusterHealthRequest, new RestStatusToXContentListener<>(channel));
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:28,代码来源:RestClusterHealthAction.java

示例2: handleRequest

import org.elasticsearch.action.admin.cluster.health.ClusterHealthRequest; //导入方法依赖的package包/类
@Override
public void handleRequest(final RestRequest request, final RestChannel channel, final Client client) {
    ClusterHealthRequest clusterHealthRequest = clusterHealthRequest(Strings.splitStringByCommaToArray(request.param("index")));
    clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local()));
    clusterHealthRequest.masterNodeTimeout(request.paramAsTime("master_timeout", clusterHealthRequest.masterNodeTimeout()));
    clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout()));
    String waitForStatus = request.param("wait_for_status");
    if (waitForStatus != null) {
        clusterHealthRequest.waitForStatus(ClusterHealthStatus.valueOf(waitForStatus.toUpperCase(Locale.ROOT)));
    }
    clusterHealthRequest.waitForRelocatingShards(request.paramAsInt("wait_for_relocating_shards", clusterHealthRequest.waitForRelocatingShards()));
    clusterHealthRequest.waitForActiveShards(request.paramAsInt("wait_for_active_shards", clusterHealthRequest.waitForActiveShards()));
    clusterHealthRequest.waitForNodes(request.param("wait_for_nodes", clusterHealthRequest.waitForNodes()));
    client.admin().cluster().health(clusterHealthRequest, new RestStatusToXContentListener<ClusterHealthResponse>(channel));
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:16,代码来源:RestClusterHealthAction.java


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