func (a Aggregations) BucketScript(name string) (*AggregationPipelineSimpleValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineSimpleValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
BucketScript returns bucket script pipeline aggregation results.
See https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-pipeline-bucket-script-aggregation.html
package elastic
import (
	"bytes"
	"encoding/json"
)
type Aggregation interface {
	Source() (interface{}, error)
}
type Aggregations map[string]*json.RawMessage
func (a Aggregations) Min(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Max(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Avg(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) ValueCount(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Cardinality(name string) (*AggregationValueMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationValueMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationStatsMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) ExtendedStats(name string) (*AggregationExtendedStatsMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationExtendedStatsMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Percentiles(name string) (*AggregationPercentilesMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPercentilesMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) PercentileRanks(name string) (*AggregationPercentilesMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPercentilesMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) TopHits(name string) (*AggregationTopHitsMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationTopHitsMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Global(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Filter(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Filters(name string) (*AggregationBucketFilters, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketFilters)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Missing(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Nested(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) ReverseNested(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Terms(name string) (*AggregationBucketKeyItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketKeyItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) SignificantTerms(name string) (*AggregationBucketSignificantTerms, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketSignificantTerms)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Sampler(name string) (*AggregationSingleBucket, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationSingleBucket)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Range(name string) (*AggregationBucketRangeItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketRangeItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) KeyedRange(name string) (*AggregationBucketKeyedRangeItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketKeyedRangeItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) DateRange(name string) (*AggregationBucketRangeItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketRangeItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) IPv4Range(name string) (*AggregationBucketRangeItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketRangeItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Histogram(name string) (*AggregationBucketHistogramItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketHistogramItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) DateHistogram(name string) (*AggregationBucketHistogramItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketHistogramItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) GeoBounds(name string) (*AggregationGeoBoundsMetric, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationGeoBoundsMetric)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketKeyItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) GeoDistance(name string) (*AggregationBucketRangeItems, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationBucketRangeItems)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) AvgBucket(name string) (*AggregationPipelineSimpleValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineSimpleValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) SumBucket(name string) (*AggregationPipelineSimpleValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineSimpleValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) MaxBucket(name string) (*AggregationPipelineBucketMetricValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineBucketMetricValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) MinBucket(name string) (*AggregationPipelineBucketMetricValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineBucketMetricValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) MovAvg(name string) (*AggregationPipelineSimpleValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineSimpleValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) Derivative(name string) (*AggregationPipelineDerivative, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineDerivative)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}
func (a Aggregations) CumulativeSum(name string) (*AggregationPipelineSimpleValue, bool) {
	if raw, found := a[name]; found {
		agg := new(AggregationPipelineSimpleValue)
		if raw == nil {
			return agg, true
		}
		if err := json.Unmarshal(*raw, agg); err == nil {
			return agg, true
		}
	}
	return nil, false
}