public List<List<Map<String, Object>>> targetShards(Resource resource) throws IOException {
    List<List<Map<String, Object>>> shardsJson = null;

    if (indexReadMissingAsEmpty) {
      Response res = execute(GET, resource.targetShards(), false);
      if (res.status() == HttpStatus.NOT_FOUND) {
        shardsJson = Collections.emptyList();
      } else {
        shardsJson = parseContent(res.body(), "shards");
      }
    } else {
      shardsJson = get(resource.targetShards(), "shards");
    }

    return shardsJson;
  }
  public void bulk(Resource resource, TrackingBytesArray data) throws IOException {
    Retry retry = retryPolicy.init();
    int httpStatus = 0;

    do {
      Response response = execute(PUT, resource.bulk(), data);
      httpStatus =
          (retryFailedEntries(response.body(), data)
              ? HttpStatus.SERVICE_UNAVAILABLE
              : HttpStatus.OK);
    } while (data.length() > 0 && retry.retry(httpStatus));
  }
 public void refresh(Resource resource) throws IOException {
   execute(POST, resource.refresh());
 }