func (a *FiltersAggregation) Source() (interface{}, error) {
	source := make(map[string]interface{})
	filters := make(map[string]interface{})
	source["filters"] = filters
	if len(a.unnamedFilters) > 0 && len(a.namedFilters) > 0 {
		return nil, errors.New("elastic: use either named or unnamed filters with FiltersAggregation but not both")
	}
	if len(a.unnamedFilters) > 0 {
		arr := make([]interface{}, len(a.unnamedFilters))
		for i, filter := range a.unnamedFilters {
			src, err := filter.Source()
			if err != nil {
				return nil, err
			}
			arr[i] = src
		}
		filters["filters"] = arr
	} else {
		dict := make(map[string]interface{})
		for key, filter := range a.namedFilters {
			src, err := filter.Source()
			if err != nil {
				return nil, err
			}
			dict[key] = src
		}
		filters["filters"] = dict
	}
	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
}
Source returns the a JSON-serializable interface.
If the aggregation is invalid, an error is returned. This may e.g. happen
if you mixed named and unnamed filters.
package elastic
import "errors"
type FiltersAggregation struct {
	unnamedFilters  []Query
	namedFilters    map[string]Query
	subAggregations map[string]Aggregation
	meta            map[string]interface{}
}
func NewFiltersAggregation() *FiltersAggregation {
	return &FiltersAggregation{
		unnamedFilters:  make([]Query, 0),
		namedFilters:    make(map[string]Query),
		subAggregations: make(map[string]Aggregation),
	}
}
func (a *FiltersAggregation) Filter(filter Query) *FiltersAggregation {
	a.unnamedFilters = append(a.unnamedFilters, filter)
	return a
}
func (a *FiltersAggregation) Filters(filters ...Query) *FiltersAggregation {
	if len(filters) > 0 {
		a.unnamedFilters = append(a.unnamedFilters, filters...)
	}
	return a
}
func (a *FiltersAggregation) FilterWithName(name string, filter Query) *FiltersAggregation {
	a.namedFilters[name] = filter
	return a
}
func (a *FiltersAggregation) SubAggregation(name string, subAggregation Aggregation) *FiltersAggregation {
	a.subAggregations[name] = subAggregation
	return a
}
func (a *FiltersAggregation) Meta(metaData map[string]interface{}) *FiltersAggregation {
	a.meta = metaData
	return a
}