docs: public void flush() {
          BulkResponse bulk = tryFlush();
          if (!bulk.getDocumentErrors().isEmpty()) {
              int maxErrors = 5;
              String header = String.format("Could not write all entries for bulk operation [%s/%s]. Error " +
                      "sample (first [%s] error messages):\n", bulk.getDocumentErrors().size(), bulk.getTotalDocs(), maxErrors);
              StringBuilder message = new StringBuilder(header);
              int i = 0;
              for (BulkResponse.BulkError errors : bulk.getDocumentErrors()) {
                  if (i >=maxErrors ) {
                      break;
                  }
                  message.append("\t");
                  appendError(message, errors.getError());
                  message.append("\n");
                  message.append("\t")
                  	.append(errors.getDocument().toString())
                  	.append("\n");
                  i++;
              }
              message.append("Bailing out...");
              throw new EsHadoopException(message.toString());
          }
      }