public IndicesStatsResponse indicesStats(String... indices) {
    return execute(() -> {
      Request request = new Request("GET", "/" + (indices.length > 0 ? (String.join(",", indices) + "/") : "") + "_stats");
      request.addParameter("level", "shards");
      Response response = restHighLevelClient.getLowLevelClient().performRequest(request);
      return IndicesStatsResponse.toIndicesStatsResponse(gson.fromJson(EntityUtils.toString(response.getEntity()), JsonObject.class));
    }, () -> computeDetailsAsString(indices));
  }
@Test
  public void should_rethrow_ex_on_indices_stat_fail() throws Exception {
    when(restClient.performRequest(argThat(new RawRequestMatcher(
      "GET",
      "/_stats"))))
      .thenThrow(IOException.class);

    assertThatThrownBy(() -> underTest.indicesStats())
      .isInstanceOf(ElasticsearchException.class);
  }