@Test
  @ElasticsearchIndexes(
      indexes = {
        @ElasticsearchIndex(
            indexName = "library",
            forceCreate = true,
            settings = {
              @ElasticsearchSetting(name = "number_of_shards", value = "2"),
              @ElasticsearchSetting(name = "number_of_replicas", value = "1")
            }),
        @ElasticsearchIndex(indexName = "people")
      })
  public void testElasticsearchSettings() {

    // Check custom settings on node
    NodesInfoResponse infoResponse =
        adminClient.cluster().prepareNodesInfo("node0").setSettings(true).execute().actionGet();

    Settings nodeSettings = infoResponse.getAt(0).getSettings();
    assertEquals("false", nodeSettings.get("http.enabled"));
    assertEquals("zone_one", nodeSettings.get("node.zone"));

    // Check custom settings on index
    ClusterStateResponse response = adminClient.cluster().prepareState().execute().actionGet();

    Settings indexSettings = response.getState().metaData().index("library").settings();
    assertEquals("2", indexSettings.get("index.number_of_shards"));
    assertEquals("1", indexSettings.get("index.number_of_replicas"));

    // Check default settings
    indexSettings = response.getState().metaData().index("people").settings();
    assertEquals("1", indexSettings.get("index.number_of_shards"));
    assertEquals("0", indexSettings.get("index.number_of_replicas"));
  }
  @Override
  public ClusterHealthResponse getClusterHealthResponse(long timeout) {
    Client client = getClient();

    AdminClient adminClient = client.admin();

    ClusterAdminClient clusterAdminClient = adminClient.cluster();

    ClusterHealthRequestBuilder clusterHealthRequestBuilder = clusterAdminClient.prepareHealth();

    clusterHealthRequestBuilder.setTimeout(TimeValue.timeValueMillis(timeout));

    clusterHealthRequestBuilder.setWaitForYellowStatus();

    Future<ClusterHealthResponse> future = clusterHealthRequestBuilder.execute();

    try {
      return future.get();
    } catch (Exception e) {
      throw new IllegalStateException(e);
    }
  }
 @Override
 public ClusterAdminClient cluster() {
   return new GlobalTimeoutClusterAdminClient(in.cluster(), timeout, unit);
 }
 @Override
 public IndicesAdminClient indices() {
   return new GlobalTimeoutIndicesAdminClient(in.indices(), timeout, unit);
 }