@Override
  public Health check(Set<NodeHealth> nodeHealths) {
    ClusterHealthResponse esClusterHealth = this.getEsClusterHealth();
    if (esClusterHealth != null) {
      Health minimumNodes = checkMinimumNodes(esClusterHealth);
      Health clusterStatus = extractStatusHealth(esClusterHealth);
      return HealthReducer.merge(minimumNodes, clusterStatus);
    }
    return RED_HEALTH_UNAVAILABLE;
  }
@Test
  public void check_returns_YELLOW_with_cause_if_ES_cluster_has_less_than_three_nodes_but_status_is_green() {
    Set<NodeHealth> nodeHealths = ImmutableSet.of(newNodeHealth(GREEN));
    when(esClient.clusterHealth(any()).getStatus()).thenReturn(ClusterHealthStatus.GREEN);
    when(esClient.clusterHealth(any()).getNumberOfNodes()).thenReturn(2);

    Health health = underTest.check(nodeHealths);

    assertThat(health.getStatus()).isEqualTo(Health.Status.YELLOW);
    assertThat(health.getCauses()).containsOnly("There should be at least three search nodes");
  }