code: func (b *BulkIndexer) Send(buf *bytes.Buffer) error {
  	type responseStruct struct {
  		Took   int64                    `json:"took"`
  		Errors bool                     `json:"errors"`
  		Items  []map[string]interface{} `json:"items"`
  	}
  
  	response := responseStruct{}
  
  	body, err := b.conn.DoCommand("POST", fmt.Sprintf("/_bulk?refresh=%t", b.Refresh), nil, buf)
  
  	if err != nil {
  		atomic.AddUint64(&b.numErrors, 1)
  		return err
  	}
  	// check for response errors, bulk insert will give 200 OK but then include errors in response
  	jsonErr := json.Unmarshal(body, &response)
  	if jsonErr == nil {
  		if response.Errors {
  			atomic.AddUint64(&b.numErrors, uint64(len(response.Items)))
  			return fmt.Errorf("Bulk Insertion Error. Failed item count [%d]", len(response.Items))
  		}
  	}
  	return nil
  }
docs: // This does the actual send of a buffer, which has already been formatted
  // into bytes of ES formatted bulk data