code: public BulkActionResponse bulk(Resource resource, TrackingBytesArray data) {
          // NB: dynamically get the stats since the transport can change
          long start = network.transportStats().netTotalTime;
          Response response = execute(PUT, resource.bulk(), data);
          long spent = network.transportStats().netTotalTime - start;
  
          stats.bulkTotal++;
          stats.docsSent += data.entries();
          stats.bulkTotalTime += spent;
          // bytes will be counted by the transport layer
  
          return new BulkActionResponse(parseBulkActionResponse(response), response.status(), spent);
      }
docs: Executes a single bulk operation against the provided resource, using the passed data as the request body.
  This method will retry bulk requests if the entire bulk request fails, but will not retry singular
  document failures.
  
  @param resource target of the bulk request.
  @param data bulk request body. This body will be cleared of entries on any successful bulk request.
  @return a BulkActionResponse object that will detail if there were failing documents that should be retried.