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

Examples of org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder


        } catch (InterruptedException e) {
        }
    }

    private void printClusterStatus() {
        ClusterHealthRequestBuilder healthRequestBuilder = elasticsearchClient.admin().cluster().prepareHealth();
        ClusterHealthResponse response = healthRequestBuilder.execute().actionGet();
        if (response.getStatus().equals(ClusterHealthStatus.RED)) {
            LOG.error("Cluster health is RED. Indexing ability will be limited");
        } else if (response.getStatus().equals(ClusterHealthStatus.YELLOW)) {
            LOG.warn("Cluster health is YELLOW.");
        } else if (response.getStatus().equals(ClusterHealthStatus.GREEN)) {
View Full Code Here


      // make sure the index is ready
      index.execute(new Esi4JOperation<Void>() {

        @Override
        public Void execute(Client client, String indexName, OperationContext helper) {
          ClusterHealthRequestBuilder request = client.admin().cluster().prepareHealth(indexName);

          request.setWaitForGreenStatus().setTimeout(_healthTimeout);

          ClusterHealthResponse response = request.execute().actionGet();

          if (response.getStatus() != ClusterHealthStatus.GREEN) {
            throw new IllegalStateException("cluster not ready for rebuild (status " + response.getStatus()
                + ")");
          }
View Full Code Here

  SearchClient searchClient = new SearchClient(new Settings(), profiling);

  @Test
  public void state() {
    try {
      ClusterHealthRequestBuilder requestBuilder = searchClient.prepareHealth();
      requestBuilder.get();

      // expected to fail because elasticsearch is not correctly configured, but that does not matter
      fail();
    } catch (IllegalStateException e) {
      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster health request");
View Full Code Here

  public void with_profiling_basic() {
    Profiling profiling = new Profiling(new Settings().setProperty(Profiling.CONFIG_PROFILING_LEVEL, Profiling.Level.BASIC.name()));
    SearchClient searchClient = new SearchClient(new Settings(), profiling);

    try {
      ClusterHealthRequestBuilder requestBuilder = searchClient.prepareHealth();
      requestBuilder.get();

      // expected to fail because elasticsearch is not correctly configured, but that does not matter
      fail();
    } catch (IllegalStateException e) {
      assertThat(e.getMessage()).isEqualTo("Fail to execute ES cluster health request");
View Full Code Here

      // make sure the index is ready
      index.execute(new Esi4JOperation<Void>() {

        @Override
        public Void execute(Client client, String indexName, OperationContext helper) {
          ClusterHealthRequestBuilder request = client.admin().cluster().prepareHealth(indexName);

          request.setWaitForGreenStatus().setTimeout(_healthTimeout);

          ClusterHealthResponse response = request.execute().actionGet();

          if (response.getStatus() != ClusterHealthStatus.GREEN) {
            throw new IllegalStateException("cluster not ready for rebuild (status " + response.getStatus()
                + ")");
          }
View Full Code Here

        execute(ClusterHealthAction.INSTANCE, request, listener);
    }

    @Override
    public ClusterHealthRequestBuilder prepareHealth(String... indices) {
        return new ClusterHealthRequestBuilder(this).setIndices(indices);
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.action.admin.cluster.health.ClusterHealthRequestBuilder

Copyright © 2018 www.massapicom. 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.