func (r *SearchRequest) AllowPartialSearchResults(allow bool) *SearchRequest {
	r.allowPartialSearchResults = &allow
	return r
}
AllowPartialSearchResults indicates if this request should allow partial
results. (If method is not called, will default to the cluster level
setting).
package elastic
import (
	"encoding/json"
	"strings"
)
type SearchRequest struct {
	searchType                 string
	indices                    []string
	types                      []string
	routing                    *string
	preference                 *string
	requestCache               *bool
	allowPartialSearchResults  *bool
	ignoreUnavailable          *bool
	allowNoIndices             *bool
	expandWildcards            string
	scroll                     string
	source                     interface{}
	searchSource               *SearchSource
	batchedReduceSize          *int
	maxConcurrentShardRequests *int
	preFilterShardSize         *int
}
func NewSearchRequest() *SearchRequest {
	return &SearchRequest{
		searchSource: NewSearchSource(),
	}
}
func (r *SearchRequest) SearchType(searchType string) *SearchRequest {
	r.searchType = searchType
	return r
}
func (r *SearchRequest) SearchTypeDfsQueryThenFetch() *SearchRequest {
	return r.SearchType("dfs_query_then_fetch")
}
func (r *SearchRequest) SearchTypeQueryThenFetch() *SearchRequest {
	return r.SearchType("query_then_fetch")
}
func (r *SearchRequest) Index(indices ...string) *SearchRequest {
	r.indices = append(r.indices, indices...)
	return r
}
func (r *SearchRequest) HasIndices() bool {
	return len(r.indices) > 0
}
func (r *SearchRequest) Type(types ...string) *SearchRequest {
	r.types = append(r.types, types...)
	return r
}
func (r *SearchRequest) Routing(routing string) *SearchRequest {
	r.routing = &routing
	return r
}
func (r *SearchRequest) Routings(routings ...string) *SearchRequest {
	if routings != nil {
		routings := strings.Join(routings, ",")
		r.routing = &routings
	} else {
		r.routing = nil
	}
	return r
}
func (r *SearchRequest) Preference(preference string) *SearchRequest {
	r.preference = &preference
	return r
}
func (r *SearchRequest) RequestCache(requestCache bool) *SearchRequest {
	r.requestCache = &requestCache
	return r
}
func (s *SearchRequest) IgnoreUnavailable(ignoreUnavailable bool) *SearchRequest {
	s.ignoreUnavailable = &ignoreUnavailable
	return s
}
func (s *SearchRequest) AllowNoIndices(allowNoIndices bool) *SearchRequest {
	s.allowNoIndices = &allowNoIndices
	return s
}
func (s *SearchRequest) ExpandWildcards(expandWildcards string) *SearchRequest {
	s.expandWildcards = expandWildcards
	return s
}
func (r *SearchRequest) Scroll(scroll string) *SearchRequest {
	r.scroll = scroll
	return r
}
func (r *SearchRequest) SearchSource(searchSource *SearchSource) *SearchRequest {
	if searchSource == nil {
		r.searchSource = NewSearchSource()
		return r
	}
	r.searchSource = searchSource
	return r
}
func (r *SearchRequest) Source(source interface{}) *SearchRequest {
	r.source = source
	return r
}
func (r *SearchRequest) Timeout(timeout string) *SearchRequest {
	r.searchSource = r.searchSource.Timeout(timeout)
	return r
}
func (r *SearchRequest) TerminateAfter(docs int) *SearchRequest {
	r.searchSource = r.searchSource.TerminateAfter(docs)
	return r
}
func (r *SearchRequest) Query(query Query) *SearchRequest {
	r.searchSource = r.searchSource.Query(query)
	return r
}
func (r *SearchRequest) PostFilter(filter Query) *SearchRequest {
	r.searchSource = r.searchSource.PostFilter(filter)
	return r
}
func (r *SearchRequest) MinScore(minScore float64) *SearchRequest {
	r.searchSource = r.searchSource.MinScore(minScore)
	return r
}
func (r *SearchRequest) From(from int) *SearchRequest {
	r.searchSource = r.searchSource.From(from)
	return r
}
func (r *SearchRequest) Size(size int) *SearchRequest {
	r.searchSource = r.searchSource.Size(size)
	return r
}
func (r *SearchRequest) Explain(explain bool) *SearchRequest {
	r.searchSource = r.searchSource.Explain(explain)
	return r
}
func (r *SearchRequest) Version(version bool) *SearchRequest {
	r.searchSource = r.searchSource.Version(version)
	return r
}
func (r *SearchRequest) IndexBoost(index string, boost float64) *SearchRequest {
	r.searchSource = r.searchSource.IndexBoost(index, boost)
	return r
}
func (r *SearchRequest) Stats(statsGroup ...string) *SearchRequest {
	r.searchSource = r.searchSource.Stats(statsGroup...)
	return r
}
func (r *SearchRequest) FetchSource(fetchSource bool) *SearchRequest {
	r.searchSource = r.searchSource.FetchSource(fetchSource)
	return r
}
func (r *SearchRequest) FetchSourceIncludeExclude(include, exclude []string) *SearchRequest {
	r.searchSource = r.searchSource.FetchSourceIncludeExclude(include, exclude)
	return r
}
func (r *SearchRequest) FetchSourceContext(fsc *FetchSourceContext) *SearchRequest {
	r.searchSource = r.searchSource.FetchSourceContext(fsc)
	return r
}
func (r *SearchRequest) DocValueField(field string) *SearchRequest {
	r.searchSource = r.searchSource.DocvalueField(field)
	return r
}
func (r *SearchRequest) DocValueFieldWithFormat(field DocvalueField) *SearchRequest {
	r.searchSource = r.searchSource.DocvalueFieldWithFormat(field)
	return r
}
func (r *SearchRequest) DocValueFields(fields ...string) *SearchRequest {
	r.searchSource = r.searchSource.DocvalueFields(fields...)
	return r
}
func (r *SearchRequest) DocValueFieldsWithFormat(fields ...DocvalueField) *SearchRequest {
	r.searchSource = r.searchSource.DocvalueFieldsWithFormat(fields...)
	return r
}
func (r *SearchRequest) StoredField(field string) *SearchRequest {
	r.searchSource = r.searchSource.StoredField(field)
	return r
}
func (r *SearchRequest) NoStoredFields() *SearchRequest {
	r.searchSource = r.searchSource.NoStoredFields()
	return r
}
func (r *SearchRequest) StoredFields(fields ...string) *SearchRequest {
	r.searchSource = r.searchSource.StoredFields(fields...)
	return r
}
func (r *SearchRequest) ScriptField(field *ScriptField) *SearchRequest {
	r.searchSource = r.searchSource.ScriptField(field)
	return r
}
func (r *SearchRequest) ScriptFields(fields ...*ScriptField) *SearchRequest {
	r.searchSource = r.searchSource.ScriptFields(fields...)
	return r
}
func (r *SearchRequest) Sort(field string, ascending bool) *SearchRequest {
	r.searchSource = r.searchSource.Sort(field, ascending)
	return r
}
func (r *SearchRequest) SortWithInfo(info SortInfo) *SearchRequest {
	r.searchSource = r.searchSource.SortWithInfo(info)
	return r
}
func (r *SearchRequest) SortBy(sorter ...Sorter) *SearchRequest {
	r.searchSource = r.searchSource.SortBy(sorter...)
	return r
}
func (r *SearchRequest) SearchAfter(sortValues ...interface{}) *SearchRequest {
	r.searchSource = r.searchSource.SearchAfter(sortValues...)
	return r
}
func (r *SearchRequest) Slice(sliceQuery Query) *SearchRequest {
	r.searchSource = r.searchSource.Slice(sliceQuery)
	return r
}
func (r *SearchRequest) TrackScores(trackScores bool) *SearchRequest {
	r.searchSource = r.searchSource.TrackScores(trackScores)
	return r
}
func (r *SearchRequest) TrackTotalHits(trackTotalHits bool) *SearchRequest {
	r.searchSource = r.searchSource.TrackTotalHits(trackTotalHits)
	return r
}
func (r *SearchRequest) Aggregation(name string, aggregation Aggregation) *SearchRequest {
	r.searchSource = r.searchSource.Aggregation(name, aggregation)
	return r
}
func (r *SearchRequest) Highlight(highlight *Highlight) *SearchRequest {
	r.searchSource = r.searchSource.Highlight(highlight)
	return r
}
func (r *SearchRequest) Suggester(suggester Suggester) *SearchRequest {
	r.searchSource = r.searchSource.Suggester(suggester)
	return r
}
func (r *SearchRequest) Rescorer(rescore *Rescore) *SearchRequest {
	r.searchSource = r.searchSource.Rescorer(rescore)
	return r
}
func (r *SearchRequest) ClearRescorers() *SearchRequest {
	r.searchSource = r.searchSource.ClearRescorers()
	return r
}
func (r *SearchRequest) Profile(profile bool) *SearchRequest {
	r.searchSource = r.searchSource.Profile(profile)
	return r
}
func (r *SearchRequest) Collapse(collapse *CollapseBuilder) *SearchRequest {
	r.searchSource = r.searchSource.Collapse(collapse)
	return r
}