code: @Override
      protected Result check() throws Exception {
          final IndicesStatsResponse indicesStatsResponse = client.admin().indices().prepareStats(indices).get();
  
          final List<String> indexDetails = new ArrayList<String>(indices.length);
          boolean healthy = true;
  
          for (IndexStats indexStats : indicesStatsResponse.getIndices().values()) {
              long documentCount = indexStats.getPrimaries().getDocs().getCount();
  
              if (documentCount < documentThreshold) {
                  healthy = false;
                  indexDetails.add(String.format("%s (%d)", indexStats.getIndex(), documentCount));
              } else {
                  indexDetails.add(String.format("%s (%d!)", indexStats.getIndex(), documentCount));
              }
          }
  
          final String resultDetails = String.format("Last stats: %s", indexDetails);
  
          if (healthy) {
              return Result.healthy(resultDetails);
          } else {
              return Result.unhealthy(resultDetails);
          }
      }
docs: Perform a check of the number of documents in the Elasticsearch indices.
  
  @return if the Elasticsearch indices contain the minimal number of documents, a healthy
  {@link com.codahale.metrics.health.HealthCheck.Result}; otherwise, an unhealthy
  {@link com.codahale.metrics.health.HealthCheck.Result} with a descriptive error message or exception
  @throws Exception if there is an unhandled error during the health check; this will result in
  a failed health check