func (a *CompositeAggregationHistogramValuesSource) Interval(interval float64) *CompositeAggregationHistogramValuesSource {
	a.interval = interval
	return a
}
Interval specifies the interval to use.
package elastic
type CompositeAggregation struct {
	after           map[string]interface{}
	size            *int
	sources         []CompositeAggregationValuesSource
	subAggregations map[string]Aggregation
	meta            map[string]interface{}
}
func NewCompositeAggregation() *CompositeAggregation {
	return &CompositeAggregation{
		sources:         make([]CompositeAggregationValuesSource, 0),
		subAggregations: make(map[string]Aggregation),
	}
}
func (a *CompositeAggregation) Size(size int) *CompositeAggregation {
	a.size = &size
	return a
}
func (a *CompositeAggregation) AggregateAfter(after map[string]interface{}) *CompositeAggregation {
	a.after = after
	return a
}
func (a *CompositeAggregation) Sources(sources ...CompositeAggregationValuesSource) *CompositeAggregation {
	a.sources = append(a.sources, sources...)
	return a
}
func (a *CompositeAggregation) SubAggregation(name string, subAggregation Aggregation) *CompositeAggregation {
	a.subAggregations[name] = subAggregation
	return a
}
func (a *CompositeAggregation) Meta(metaData map[string]interface{}) *CompositeAggregation {
	a.meta = metaData
	return a
}
func (a *CompositeAggregation) Source() (interface{}, error) {
	source := make(map[string]interface{})
	opts := make(map[string]interface{})
	source["composite"] = opts
	sources := make([]interface{}, len(a.sources))
	for i, s := range a.sources {
		src, err := s.Source()
		if err != nil {
			return nil, err
		}
		sources[i] = src
	}
	opts["sources"] = sources
	if a.size != nil {
		opts["size"] = *a.size
	}
	if a.after != nil {
		opts["after"] = a.after
	}
	if len(a.subAggregations) > 0 {
		aggsMap := make(map[string]interface{})
		source["aggregations"] = aggsMap
		for name, aggregate := range a.subAggregations {
			src, err := aggregate.Source()
			if err != nil {
				return nil, err
			}
			aggsMap[name] = src
		}
	}
	if len(a.meta) > 0 {
		source["meta"] = a.meta
	}
	return source, nil
}
type CompositeAggregationValuesSource interface {
	Source() (interface{}, error)
}
type CompositeAggregationTermsValuesSource struct {
	name      string
	field     string
	script    *Script
	valueType string
	missing   interface{}
	order     string
}
func NewCompositeAggregationTermsValuesSource(name string) *CompositeAggregationTermsValuesSource {
	return &CompositeAggregationTermsValuesSource{
		name: name,
	}
}
func (a *CompositeAggregationTermsValuesSource) Field(field string) *CompositeAggregationTermsValuesSource {
	a.field = field
	return a
}
func (a *CompositeAggregationTermsValuesSource) Script(script *Script) *CompositeAggregationTermsValuesSource {
	a.script = script
	return a
}
func (a *CompositeAggregationTermsValuesSource) ValueType(valueType string) *CompositeAggregationTermsValuesSource {
	a.valueType = valueType
	return a
}
func (a *CompositeAggregationTermsValuesSource) Order(order string) *CompositeAggregationTermsValuesSource {
	a.order = order
	return a
}
func (a *CompositeAggregationTermsValuesSource) Asc() *CompositeAggregationTermsValuesSource {
	a.order = "asc"
	return a
}
func (a *CompositeAggregationTermsValuesSource) Desc() *CompositeAggregationTermsValuesSource {
	a.order = "desc"
	return a
}
func (a *CompositeAggregationTermsValuesSource) Missing(missing interface{}) *CompositeAggregationTermsValuesSource {
	a.missing = missing
	return a
}
func (a *CompositeAggregationTermsValuesSource) Source() (interface{}, error) {
	source := make(map[string]interface{})
	name := make(map[string]interface{})
	source[a.name] = name
	values := make(map[string]interface{})
	name["terms"] = values
	if a.field != "" {
		values["field"] = a.field
	}
	if a.script != nil {
		src, err := a.script.Source()
		if err != nil {
			return nil, err
		}
		values["script"] = src
	}
	if a.missing != nil {
		values["missing"] = a.missing
	}
	if a.valueType != "" {
		values["value_type"] = a.valueType
	}
	if a.order != "" {
		values["order"] = a.order
	}
	return source, nil
}
type CompositeAggregationHistogramValuesSource struct {
	name      string
	field     string
	script    *Script
	valueType string
	missing   interface{}
	order     string
	interval  float64
}
func NewCompositeAggregationHistogramValuesSource(name string, interval float64) *CompositeAggregationHistogramValuesSource {
	return &CompositeAggregationHistogramValuesSource{
		name:     name,
		interval: interval,
	}
}
func (a *CompositeAggregationHistogramValuesSource) Field(field string) *CompositeAggregationHistogramValuesSource {
	a.field = field
	return a
}
func (a *CompositeAggregationHistogramValuesSource) Script(script *Script) *CompositeAggregationHistogramValuesSource {
	a.script = script
	return a
}
func (a *CompositeAggregationHistogramValuesSource) ValueType(valueType string) *CompositeAggregationHistogramValuesSource {
	a.valueType = valueType
	return a
}
func (a *CompositeAggregationHistogramValuesSource) Missing(missing interface{}) *CompositeAggregationHistogramValuesSource {
	a.missing = missing
	return a
}
func (a *CompositeAggregationHistogramValuesSource) Order(order string) *CompositeAggregationHistogramValuesSource {
	a.order = order
	return a
}
func (a *CompositeAggregationHistogramValuesSource) Asc() *CompositeAggregationHistogramValuesSource {
	a.order = "asc"
	return a
}
func (a *CompositeAggregationHistogramValuesSource) Desc() *CompositeAggregationHistogramValuesSource {
	a.order = "desc"
	return a
}