func (s *BulkProcessorService) Do(ctx context.Context) (*BulkProcessor, error) {
	p := newBulkProcessor(
		s.c,
		s.beforeFn,
		s.afterFn,
		s.name,
		s.numWorkers,
		s.bulkActions,
		s.bulkSize,
		s.flushInterval,
		s.wantStats,
		s.backoff)
	err := p.Start(ctx)
	if err != nil {
		return nil, err
	}
	return p, nil
}
Do creates a new BulkProcessor and starts it.
Consider the BulkProcessor as a running instance that accepts bulk requests
and commits them to Elasticsearch, spreading the work across one or more
workers.

You can interoperate with the BulkProcessor returned by Do, e.g. Start and
Stop (or Close) it.

Context is an optional context that is passed into the bulk request
service calls. In contrast to other operations, this context is used in
a long running process. You could use it to pass e.g. loggers, but you
shouldn't use it for cancellation.

Calling Do several times returns new BulkProcessors. You probably don't
want to do this. BulkProcessorService implements just a builder pattern.
package elastic
import (
	"context"
	"sync"
	"sync/atomic"
	"time"
)
type BulkProcessorService struct {
	c             *Client
	beforeFn      BulkBeforeFunc
	afterFn       BulkAfterFunc
	name          string         
	numWorkers    int            
	bulkActions   int            
	bulkSize      int            
	flushInterval time.Duration  
	wantStats     bool           
	backoff       Backoff        
}
func NewBulkProcessorService(client *Client) *BulkProcessorService {
	return &BulkProcessorService{
		c:           client,
		numWorkers:  1,
		bulkActions: 1000,
		bulkSize:    5 << 20,  
		backoff: NewExponentialBackoff(
			time.Duration(200)*time.Millisecond,
			time.Duration(10000)*time.Millisecond,
		),
	}
}
type BulkBeforeFunc func(executionId int64, requests []BulkableRequest)
type BulkAfterFunc func(executionId int64, requests []BulkableRequest, response *BulkResponse, err error)
func (s *BulkProcessorService) Before(fn BulkBeforeFunc) *BulkProcessorService {
	s.beforeFn = fn
	return s
}
func (s *BulkProcessorService) After(fn BulkAfterFunc) *BulkProcessorService {
	s.afterFn = fn
	return s
}
func (s *BulkProcessorService) Name(name string) *BulkProcessorService {
	s.name = name
	return s
}
func (s *BulkProcessorService) Workers(num int) *BulkProcessorService {
	s.numWorkers = num
	return s
}
func (s *BulkProcessorService) BulkActions(bulkActions int) *BulkProcessorService {
	s.bulkActions = bulkActions
	return s
}
func (s *BulkProcessorService) BulkSize(bulkSize int) *BulkProcessorService {
	s.bulkSize = bulkSize
	return s
}
func (s *BulkProcessorService) FlushInterval(interval time.Duration) *BulkProcessorService {
	s.flushInterval = interval
	return s
}
func (s *BulkProcessorService) Stats(wantStats bool) *BulkProcessorService {
	s.wantStats = wantStats
	return s
}
func (s *BulkProcessorService) Backoff(backoff Backoff) *BulkProcessorService {
	s.backoff = backoff
	return s
}