func (s *BulkProcessorService) Before(fn BulkBeforeFunc) *BulkProcessorService {
	s.beforeFn = fn
	return s
}
Before specifies a function to be executed before bulk requests get comitted
to Elasticsearch.
package elastic
import (
	"sync"
	"sync/atomic"
	"time"
	"gopkg.in/olivere/elastic.v3/backoff"
)
type BulkProcessorService struct {
	c              *Client
	beforeFn       BulkBeforeFunc
	afterFn        BulkAfterFunc
	name           string         
	numWorkers     int            
	bulkActions    int            
	bulkSize       int            
	flushInterval  time.Duration  
	wantStats      bool           
	initialTimeout time.Duration  
	maxTimeout     time.Duration  
}
func NewBulkProcessorService(client *Client) *BulkProcessorService {
	return &BulkProcessorService{
		c:              client,
		numWorkers:     1,
		bulkActions:    1000,
		bulkSize:       5 << 20,  
		initialTimeout: time.Duration(200) * time.Millisecond,
		maxTimeout:     time.Duration(10000) * time.Millisecond,
	}
}
type BulkBeforeFunc func(executionId int64, requests []BulkableRequest)
type BulkAfterFunc func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error)