func (f Bulk) WithSourceIncludes(v ...string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.SourceIncludes = v
	}
}
WithSourceIncludes - default list of fields to extract and return from the _source field, can be overridden on each sub-request.
package opensearchapi
import (
	"context"
	"io"
	"net/http"
	"strconv"
	"strings"
	"time"
)
func newBulkFunc(t Transport) Bulk {
	return func(body io.Reader, o ...func(*BulkRequest)) (*Response, error) {
		var r = BulkRequest{Body: body}
		for _, f := range o {
			f(&r)
		}
		return r.Do(r.ctx, t)
	}
}
type Bulk func(body io.Reader, o ...func(*BulkRequest)) (*Response, error)
type BulkRequest struct {
	Index        string
	DocumentType string
	Body io.Reader
	Pipeline            string
	Refresh             string
	RequireAlias        *bool
	Routing             string
	Source              []string
	SourceExcludes      []string
	SourceIncludes      []string
	Timeout             time.Duration
	WaitForActiveShards string
	Pretty     bool
	Human      bool
	ErrorTrace bool
	FilterPath []string
	Header http.Header
	ctx context.Context
}
func (r BulkRequest) Do(ctx context.Context, transport Transport) (*Response, error) {
	var (
		method string
		path   strings.Builder
		params map[string]string
	)
	method = "POST"
	path.Grow(1 + len(r.Index) + 1 + len(r.DocumentType) + 1 + len("_bulk"))
	if r.Index != "" {
		path.WriteString("/")
		path.WriteString(r.Index)
	}
	if r.DocumentType != "" {
		path.WriteString("/")
		path.WriteString(r.DocumentType)
	}
	path.WriteString("/")
	path.WriteString("_bulk")
	params = make(map[string]string)
	if r.Pipeline != "" {
		params["pipeline"] = r.Pipeline
	}
	if r.Refresh != "" {
		params["refresh"] = r.Refresh
	}
	if r.RequireAlias != nil {
		params["require_alias"] = strconv.FormatBool(*r.RequireAlias)
	}
	if r.Routing != "" {
		params["routing"] = r.Routing
	}
	if len(r.Source) > 0 {
		params["_source"] = strings.Join(r.Source, ",")
	}
	if len(r.SourceExcludes) > 0 {
		params["_source_excludes"] = strings.Join(r.SourceExcludes, ",")
	}
	if len(r.SourceIncludes) > 0 {
		params["_source_includes"] = strings.Join(r.SourceIncludes, ",")
	}
	if r.Timeout != 0 {
		params["timeout"] = formatDuration(r.Timeout)
	}
	if r.DocumentType != "" {
		params["type"] = r.DocumentType
	}
	if r.WaitForActiveShards != "" {
		params["wait_for_active_shards"] = r.WaitForActiveShards
	}
	if r.Pretty {
		params["pretty"] = "true"
	}
	if r.Human {
		params["human"] = "true"
	}
	if r.ErrorTrace {
		params["error_trace"] = "true"
	}
	if len(r.FilterPath) > 0 {
		params["filter_path"] = strings.Join(r.FilterPath, ",")
	}
	req, err := newRequest(method, path.String(), r.Body)
	if err != nil {
		return nil, err
	}
	if len(params) > 0 {
		q := req.URL.Query()
		for k, v := range params {
			q.Set(k, v)
		}
		req.URL.RawQuery = q.Encode()
	}
	if r.Body != nil {
		req.Header[headerContentType] = headerContentTypeJSON
	}
	if len(r.Header) > 0 {
		if len(req.Header) == 0 {
			req.Header = r.Header
		} else {
			for k, vv := range r.Header {
				for _, v := range vv {
					req.Header.Add(k, v)
				}
			}
		}
	}
	if ctx != nil {
		req = req.WithContext(ctx)
	}
	res, err := transport.Perform(req)
	if err != nil {
		return nil, err
	}
	response := Response{
		StatusCode: res.StatusCode,
		Body:       res.Body,
		Header:     res.Header,
	}
	return &response, nil
}
func (f Bulk) WithContext(v context.Context) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.ctx = v
	}
}
func (f Bulk) WithIndex(v string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.Index = v
	}
}
func (f Bulk) WithDocumentType(v string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.DocumentType = v
	}
}
func (f Bulk) WithPipeline(v string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.Pipeline = v
	}
}
func (f Bulk) WithRefresh(v string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.Refresh = v
	}
}
func (f Bulk) WithRequireAlias(v bool) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.RequireAlias = &v
	}
}
func (f Bulk) WithRouting(v string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.Routing = v
	}
}
func (f Bulk) WithSource(v ...string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.Source = v
	}
}
func (f Bulk) WithSourceExcludes(v ...string) func(*BulkRequest) {
	return func(r *BulkRequest) {
		r.SourceExcludes = v
	}
}