Package org.elasticsearch.action.admin.cluster.health

Examples of org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse.timedOut()


        client1.admin().indices().create(createIndexRequest("test2")).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        logger.info("--> adding filtering aliases to index [test1]");
        client1.admin().indices().prepareAliases().addAlias("test1", "aliasToTest1").execute().actionGet();
        client1.admin().indices().prepareAliases().addAlias("test1", "aliasToTests").execute().actionGet();
View Full Code Here


        client1.admin().indices().create(createIndexRequest("test")).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        for (int i = 0; i < 10; i++) {
            assertThat(client1.admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().acknowledged(), equalTo(true));
            client2.index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet();
View Full Code Here

        client1.admin().indices().create(createIndexRequest("test").settings(settingsBuilder().put("index.numberOfReplicas", 0).put("index.numberOfShards", 1))).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        for (int i = 0; i < 10; i++) {
            assertThat(getClient().admin().indices().prepareAliases().addAlias("test", "alias" + i).execute().actionGet().acknowledged(), equalTo(true));
            getClient().index(indexRequest("alias" + i).type("type1").id("1").source(source("1", "test")).refresh(true)).actionGet();
View Full Code Here

        client1.admin().indices().create(createIndexRequest("test")).actionGet();

        logger.info("Running Cluster Health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));
        assertThat(clusterHealth.indices().get("test").activePrimaryShards(), equalTo(5));
        assertThat(clusterHealth.indices().get("test").numberOfReplicas(), equalTo(1));
        assertThat(clusterHealth.indices().get("test").activeShards(), equalTo(10));
View Full Code Here

        client1.admin().indices().create(createIndexRequest("test")).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        ExecutorService executor = Executors.newFixedThreadPool(aliasCount);
        for (int i = 0; i < aliasCount; i++) {
            final String aliasName = "alias" + i;
View Full Code Here

        client1.admin().indices().create(createIndexRequest("test")).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        assertThat(client2.admin().indices().prepareAliases().addAlias("test", "alias1").setTimeout(TimeValue.timeValueMillis(0)).execute().actionGet().acknowledged(), equalTo(false));
        assertThat(client1.admin().indices().prepareAliases().addAlias("test", "alias2").setTimeout(TimeValue.timeValueMillis(0)).execute().actionGet().acknowledged(), equalTo(false));
        assertThat(client2.admin().indices().prepareAliases().addAlias("test", "alias3").execute().actionGet().acknowledged(), equalTo(true));
View Full Code Here

        Thread.sleep(200);

        logger.info("Running Cluster Health");
        clusterHealth = client1.admin().cluster().prepareHealth().setWaitForYellowStatus().setWaitForActiveShards(10).execute().actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.YELLOW));
        assertThat(clusterHealth.indices().get("test").activePrimaryShards(), equalTo(5));
        assertThat(clusterHealth.indices().get("test").numberOfReplicas(), equalTo(2));
        assertThat(clusterHealth.indices().get("test").activeShards(), equalTo(10));
View Full Code Here

        client1.admin().indices().create(createIndexRequest("test")).actionGet();

        logger.info("--> running cluster_health");
        ClusterHealthResponse clusterHealth = client1.admin().cluster().health(clusterHealthRequest().waitForGreenStatus()).actionGet();
        logger.info("--> done cluster_health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));

        logger.info("--> creating alias1 ");
        assertThat(client2.admin().indices().prepareAliases().addAlias("test", "alias1").execute().actionGet().acknowledged(), equalTo(true));
        TimeValue timeout = TimeValue.timeValueSeconds(2);
View Full Code Here

        Thread.sleep(100);

        logger.info("Running Cluster Health");
        clusterHealth = client1.admin().cluster().prepareHealth().setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));
        assertThat(clusterHealth.indices().get("test").activePrimaryShards(), equalTo(5));
        assertThat(clusterHealth.indices().get("test").numberOfReplicas(), equalTo(2));
        assertThat(clusterHealth.indices().get("test").activeShards(), equalTo(15));
View Full Code Here

        Thread.sleep(200);

        logger.info("Running Cluster Health");
        clusterHealth = client1.admin().cluster().prepareHealth().setWaitForGreenStatus().setWaitForNodes("3").execute().actionGet();
        logger.info("Done Cluster Health, status " + clusterHealth.status());
        assertThat(clusterHealth.timedOut(), equalTo(false));
        assertThat(clusterHealth.status(), equalTo(ClusterHealthStatus.GREEN));
        assertThat(clusterHealth.indices().get("test").activePrimaryShards(), equalTo(5));
        assertThat(clusterHealth.indices().get("test").numberOfReplicas(), equalTo(0));
        assertThat(clusterHealth.indices().get("test").activeShards(), equalTo(5));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.