summaryrefslogtreecommitdiffstats
path: root/vendor/gopkg.in/olivere/elastic.v5/search_aggs.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-16 05:37:14 -0700
committerJoram Wilander <jwawilander@gmail.com>2018-04-16 08:37:14 -0400
commit6e2cb00008cbf09e556b00f87603797fcaa47e09 (patch)
tree3c0eb55ff4226a3f024aad373140d1fb860a6404 /vendor/gopkg.in/olivere/elastic.v5/search_aggs.go
parentbf24f51c4e1cc6286885460672f7f449e8c6f5ef (diff)
downloadchat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.gz
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.tar.bz2
chat-6e2cb00008cbf09e556b00f87603797fcaa47e09.zip
Depenancy upgrades and movign to dep. (#8630)
Diffstat (limited to 'vendor/gopkg.in/olivere/elastic.v5/search_aggs.go')
-rw-r--r--vendor/gopkg.in/olivere/elastic.v5/search_aggs.go263
1 files changed, 150 insertions, 113 deletions
diff --git a/vendor/gopkg.in/olivere/elastic.v5/search_aggs.go b/vendor/gopkg.in/olivere/elastic.v5/search_aggs.go
index 6359611b1..999a57d60 100644
--- a/vendor/gopkg.in/olivere/elastic.v5/search_aggs.go
+++ b/vendor/gopkg.in/olivere/elastic.v5/search_aggs.go
@@ -13,7 +13,7 @@ import (
// analytic information over a set of documents. It is
// (in many senses) the follow-up of facets in Elasticsearch.
// For more details about aggregations, visit:
-// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations.html
type Aggregation interface {
// Source returns a JSON-serializable aggregation that is a fragment
// of the request sent to Elasticsearch.
@@ -24,7 +24,7 @@ type Aggregation interface {
type Aggregations map[string]*json.RawMessage
// Min returns min aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-min-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-min-aggregation.html
func (a Aggregations) Min(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -39,7 +39,7 @@ func (a Aggregations) Min(name string) (*AggregationValueMetric, bool) {
}
// Max returns max aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-max-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-max-aggregation.html
func (a Aggregations) Max(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -54,7 +54,7 @@ func (a Aggregations) Max(name string) (*AggregationValueMetric, bool) {
}
// Sum returns sum aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-sum-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-sum-aggregation.html
func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -69,7 +69,7 @@ func (a Aggregations) Sum(name string) (*AggregationValueMetric, bool) {
}
// Avg returns average aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-avg-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-avg-aggregation.html
func (a Aggregations) Avg(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -84,7 +84,7 @@ func (a Aggregations) Avg(name string) (*AggregationValueMetric, bool) {
}
// ValueCount returns value-count aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-valuecount-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-valuecount-aggregation.html
func (a Aggregations) ValueCount(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -99,7 +99,7 @@ func (a Aggregations) ValueCount(name string) (*AggregationValueMetric, bool) {
}
// Cardinality returns cardinality aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-cardinality-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-cardinality-aggregation.html
func (a Aggregations) Cardinality(name string) (*AggregationValueMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationValueMetric)
@@ -114,7 +114,7 @@ func (a Aggregations) Cardinality(name string) (*AggregationValueMetric, bool) {
}
// Stats returns stats aggregation results.
-// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-stats-aggregation.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-stats-aggregation.html
func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationStatsMetric)
@@ -129,7 +129,7 @@ func (a Aggregations) Stats(name string) (*AggregationStatsMetric, bool) {
}
// ExtendedStats returns extended stats aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-extendedstats-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-extendedstats-aggregation.html
func (a Aggregations) ExtendedStats(name string) (*AggregationExtendedStatsMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationExtendedStatsMetric)
@@ -144,7 +144,7 @@ func (a Aggregations) ExtendedStats(name string) (*AggregationExtendedStatsMetri
}
// MatrixStats returns matrix stats aggregation results.
-// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-matrix-stats-aggregation.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-matrix-stats-aggregation.html
func (a Aggregations) MatrixStats(name string) (*AggregationMatrixStats, bool) {
if raw, found := a[name]; found {
agg := new(AggregationMatrixStats)
@@ -159,7 +159,7 @@ func (a Aggregations) MatrixStats(name string) (*AggregationMatrixStats, bool) {
}
// Percentiles returns percentiles results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-percentile-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-percentile-aggregation.html
func (a Aggregations) Percentiles(name string) (*AggregationPercentilesMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPercentilesMetric)
@@ -174,7 +174,7 @@ func (a Aggregations) Percentiles(name string) (*AggregationPercentilesMetric, b
}
// PercentileRanks returns percentile ranks results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-percentile-rank-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-percentile-rank-aggregation.html
func (a Aggregations) PercentileRanks(name string) (*AggregationPercentilesMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPercentilesMetric)
@@ -189,7 +189,7 @@ func (a Aggregations) PercentileRanks(name string) (*AggregationPercentilesMetri
}
// TopHits returns top-hits aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-top-hits-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-top-hits-aggregation.html
func (a Aggregations) TopHits(name string) (*AggregationTopHitsMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationTopHitsMetric)
@@ -204,7 +204,7 @@ func (a Aggregations) TopHits(name string) (*AggregationTopHitsMetric, bool) {
}
// Global returns global results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-global-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-global-aggregation.html
func (a Aggregations) Global(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -219,7 +219,7 @@ func (a Aggregations) Global(name string) (*AggregationSingleBucket, bool) {
}
// Filter returns filter results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-filter-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-filter-aggregation.html
func (a Aggregations) Filter(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -234,7 +234,7 @@ func (a Aggregations) Filter(name string) (*AggregationSingleBucket, bool) {
}
// Filters returns filters results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-filters-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-filters-aggregation.html
func (a Aggregations) Filters(name string) (*AggregationBucketFilters, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketFilters)
@@ -248,8 +248,23 @@ func (a Aggregations) Filters(name string) (*AggregationBucketFilters, bool) {
return nil, false
}
+// AdjacencyMatrix returning a form of adjacency matrix.
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-aggregations-bucket-adjacency-matrix-aggregation.html
+func (a Aggregations) AdjacencyMatrix(name string) (*AggregationBucketAdjacencyMatrix, bool) {
+ if raw, found := a[name]; found {
+ agg := new(AggregationBucketAdjacencyMatrix)
+ if raw == nil {
+ return agg, true
+ }
+ if err := json.Unmarshal(*raw, agg); err == nil {
+ return agg, true
+ }
+ }
+ return nil, false
+}
+
// Missing returns missing results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-missing-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-missing-aggregation.html
func (a Aggregations) Missing(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -264,7 +279,7 @@ func (a Aggregations) Missing(name string) (*AggregationSingleBucket, bool) {
}
// Nested returns nested results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-nested-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-nested-aggregation.html
func (a Aggregations) Nested(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -279,7 +294,7 @@ func (a Aggregations) Nested(name string) (*AggregationSingleBucket, bool) {
}
// ReverseNested returns reverse-nested results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-reverse-nested-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-reverse-nested-aggregation.html
func (a Aggregations) ReverseNested(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -294,7 +309,7 @@ func (a Aggregations) ReverseNested(name string) (*AggregationSingleBucket, bool
}
// Children returns children results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-children-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-children-aggregation.html
func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -309,7 +324,7 @@ func (a Aggregations) Children(name string) (*AggregationSingleBucket, bool) {
}
// Terms returns terms aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-terms-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-terms-aggregation.html
func (a Aggregations) Terms(name string) (*AggregationBucketKeyItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketKeyItems)
@@ -324,7 +339,7 @@ func (a Aggregations) Terms(name string) (*AggregationBucketKeyItems, bool) {
}
// SignificantTerms returns significant terms aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-significantterms-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-significantterms-aggregation.html
func (a Aggregations) SignificantTerms(name string) (*AggregationBucketSignificantTerms, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketSignificantTerms)
@@ -339,7 +354,7 @@ func (a Aggregations) SignificantTerms(name string) (*AggregationBucketSignifica
}
// Sampler returns sampler aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-sampler-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-sampler-aggregation.html
func (a Aggregations) Sampler(name string) (*AggregationSingleBucket, bool) {
if raw, found := a[name]; found {
agg := new(AggregationSingleBucket)
@@ -353,8 +368,23 @@ func (a Aggregations) Sampler(name string) (*AggregationSingleBucket, bool) {
return nil, false
}
+// DiversifiedSampler returns diversified_sampler aggregation results.
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-aggregations-bucket-diversified-sampler-aggregation.html
+func (a Aggregations) DiversifiedSampler(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
+}
+
// Range returns range aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-range-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-range-aggregation.html
func (a Aggregations) Range(name string) (*AggregationBucketRangeItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketRangeItems)
@@ -369,7 +399,7 @@ func (a Aggregations) Range(name string) (*AggregationBucketRangeItems, bool) {
}
// KeyedRange returns keyed range aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-range-aggregation.html.
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-range-aggregation.html.
func (a Aggregations) KeyedRange(name string) (*AggregationBucketKeyedRangeItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketKeyedRangeItems)
@@ -384,7 +414,7 @@ func (a Aggregations) KeyedRange(name string) (*AggregationBucketKeyedRangeItems
}
// DateRange returns date range aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-daterange-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-daterange-aggregation.html
func (a Aggregations) DateRange(name string) (*AggregationBucketRangeItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketRangeItems)
@@ -399,7 +429,7 @@ func (a Aggregations) DateRange(name string) (*AggregationBucketRangeItems, bool
}
// IPRange returns IP range aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-iprange-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-aggregations-bucket-iprange-aggregation.html
func (a Aggregations) IPRange(name string) (*AggregationBucketRangeItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketRangeItems)
@@ -414,7 +444,7 @@ func (a Aggregations) IPRange(name string) (*AggregationBucketRangeItems, bool)
}
// Histogram returns histogram aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-histogram-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-histogram-aggregation.html
func (a Aggregations) Histogram(name string) (*AggregationBucketHistogramItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketHistogramItems)
@@ -429,7 +459,7 @@ func (a Aggregations) Histogram(name string) (*AggregationBucketHistogramItems,
}
// DateHistogram returns date histogram aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-datehistogram-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-datehistogram-aggregation.html
func (a Aggregations) DateHistogram(name string) (*AggregationBucketHistogramItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketHistogramItems)
@@ -444,7 +474,7 @@ func (a Aggregations) DateHistogram(name string) (*AggregationBucketHistogramIte
}
// GeoBounds returns geo-bounds aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-metrics-geobounds-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-metrics-geobounds-aggregation.html
func (a Aggregations) GeoBounds(name string) (*AggregationGeoBoundsMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationGeoBoundsMetric)
@@ -459,7 +489,7 @@ func (a Aggregations) GeoBounds(name string) (*AggregationGeoBoundsMetric, bool)
}
// GeoHash returns geo-hash aggregation results.
-// https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-geohashgrid-aggregation.html
+// https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-geohashgrid-aggregation.html
func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketKeyItems)
@@ -473,8 +503,23 @@ func (a Aggregations) GeoHash(name string) (*AggregationBucketKeyItems, bool) {
return nil, false
}
+// GeoCentroid returns geo-centroid aggregation results.
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.6/search-aggregations-metrics-geocentroid-aggregation.html
+func (a Aggregations) GeoCentroid(name string) (*AggregationGeoCentroidMetric, bool) {
+ if raw, found := a[name]; found {
+ agg := new(AggregationGeoCentroidMetric)
+ if raw == nil {
+ return agg, true
+ }
+ if err := json.Unmarshal(*raw, agg); err == nil {
+ return agg, true
+ }
+ }
+ return nil, false
+}
+
// GeoDistance returns geo distance aggregation results.
-// See: https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-bucket-geodistance-aggregation.html
+// See: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-geodistance-aggregation.html
func (a Aggregations) GeoDistance(name string) (*AggregationBucketRangeItems, bool) {
if raw, found := a[name]; found {
agg := new(AggregationBucketRangeItems)
@@ -489,7 +534,7 @@ func (a Aggregations) GeoDistance(name string) (*AggregationBucketRangeItems, bo
}
// AvgBucket returns average bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-avg-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-avg-bucket-aggregation.html
func (a Aggregations) AvgBucket(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -504,7 +549,7 @@ func (a Aggregations) AvgBucket(name string) (*AggregationPipelineSimpleValue, b
}
// SumBucket returns sum bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-sum-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-sum-bucket-aggregation.html
func (a Aggregations) SumBucket(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -519,7 +564,7 @@ func (a Aggregations) SumBucket(name string) (*AggregationPipelineSimpleValue, b
}
// StatsBucket returns stats bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-stats-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-stats-bucket-aggregation.html
func (a Aggregations) StatsBucket(name string) (*AggregationPipelineStatsMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineStatsMetric)
@@ -534,7 +579,7 @@ func (a Aggregations) StatsBucket(name string) (*AggregationPipelineStatsMetric,
}
// PercentilesBucket returns stats bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-percentiles-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-percentiles-bucket-aggregation.html
func (a Aggregations) PercentilesBucket(name string) (*AggregationPipelinePercentilesMetric, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelinePercentilesMetric)
@@ -549,7 +594,7 @@ func (a Aggregations) PercentilesBucket(name string) (*AggregationPipelinePercen
}
// MaxBucket returns maximum bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-max-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-max-bucket-aggregation.html
func (a Aggregations) MaxBucket(name string) (*AggregationPipelineBucketMetricValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineBucketMetricValue)
@@ -564,7 +609,7 @@ func (a Aggregations) MaxBucket(name string) (*AggregationPipelineBucketMetricVa
}
// MinBucket returns minimum bucket pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-min-bucket-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-min-bucket-aggregation.html
func (a Aggregations) MinBucket(name string) (*AggregationPipelineBucketMetricValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineBucketMetricValue)
@@ -579,7 +624,7 @@ func (a Aggregations) MinBucket(name string) (*AggregationPipelineBucketMetricVa
}
// MovAvg returns moving average pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-movavg-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-movavg-aggregation.html
func (a Aggregations) MovAvg(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -594,7 +639,7 @@ func (a Aggregations) MovAvg(name string) (*AggregationPipelineSimpleValue, bool
}
// Derivative returns derivative pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-derivative-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-derivative-aggregation.html
func (a Aggregations) Derivative(name string) (*AggregationPipelineDerivative, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineDerivative)
@@ -609,7 +654,7 @@ func (a Aggregations) Derivative(name string) (*AggregationPipelineDerivative, b
}
// CumulativeSum returns a cumulative sum pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-cumulative-sum-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-cumulative-sum-aggregation.html
func (a Aggregations) CumulativeSum(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -624,7 +669,7 @@ func (a Aggregations) CumulativeSum(name string) (*AggregationPipelineSimpleValu
}
// BucketScript returns bucket script pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-bucket-script-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-bucket-script-aggregation.html
func (a Aggregations) BucketScript(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -639,7 +684,7 @@ func (a Aggregations) BucketScript(name string) (*AggregationPipelineSimpleValue
}
// SerialDiff returns serial differencing pipeline aggregation results.
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.0/search-aggregations-pipeline-serialdiff-aggregation.html
+// See https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-pipeline-serialdiff-aggregation.html
func (a Aggregations) SerialDiff(name string) (*AggregationPipelineSimpleValue, bool) {
if raw, found := a[name]; found {
agg := new(AggregationPipelineSimpleValue)
@@ -653,23 +698,6 @@ func (a Aggregations) SerialDiff(name string) (*AggregationPipelineSimpleValue,
return nil, false
}
-// Composite returns composite bucket aggregation results.
-//
-// See https://www.elastic.co/guide/en/elasticsearch/reference/6.1/search-aggregations-bucket-composite-aggregation.html
-// for details.
-func (a Aggregations) Composite(name string) (*AggregationBucketCompositeItems, bool) {
- if raw, found := a[name]; found {
- agg := new(AggregationBucketCompositeItems)
- if raw == nil {
- return agg, true
- }
- if err := json.Unmarshal(*raw, agg); err == nil {
- return agg, true
- }
- }
- return nil, false
-}
-
// -- Single value metric --
// AggregationValueMetric is a single-value metric, returned e.g. by a
@@ -922,6 +950,41 @@ func (a *AggregationGeoBoundsMetric) UnmarshalJSON(data []byte) error {
return nil
}
+// -- Geo Centroid --
+
+// AggregationGeocentroidMetric is a metric as returned by a GeoCentroid aggregation.
+type AggregationGeoCentroidMetric struct {
+ Aggregations
+
+ Location struct {
+ Latitude float64 `json:"lat"`
+ Longitude float64 `json:"lon"`
+ } `json:"location"`
+
+ Count int // `json:"count,omitempty"`
+
+ Meta map[string]interface{} // `json:"meta,omitempty"`
+}
+
+// UnmarshalJSON decodes JSON data and initializes an AggregationGeoCentroidMetric structure.
+func (a *AggregationGeoCentroidMetric) UnmarshalJSON(data []byte) error {
+ var aggs map[string]*json.RawMessage
+ if err := json.Unmarshal(data, &aggs); err != nil {
+ return err
+ }
+ if v, ok := aggs["location"]; ok && v != nil {
+ json.Unmarshal(*v, &a.Location)
+ }
+ if v, ok := aggs["meta"]; ok && v != nil {
+ json.Unmarshal(*v, &a.Meta)
+ }
+ if v, ok := aggs["count"]; ok && v != nil {
+ json.Unmarshal(*v, &a.Count)
+ }
+ a.Aggregations = aggs
+ return nil
+}
+
// -- Single bucket --
// AggregationSingleBucket is a single bucket, returned e.g. via an aggregation of type Global.
@@ -1215,6 +1278,33 @@ func (a *AggregationBucketFilters) UnmarshalJSON(data []byte) error {
return nil
}
+// -- Bucket AdjacencyMatrix --
+
+// AggregationBucketAdjacencyMatrix is a multi-bucket aggregation that is returned
+// with a AdjacencyMatrix aggregation.
+type AggregationBucketAdjacencyMatrix struct {
+ Aggregations
+
+ Buckets []*AggregationBucketKeyItem //`json:"buckets"`
+ Meta map[string]interface{} // `json:"meta,omitempty"`
+}
+
+// UnmarshalJSON decodes JSON data and initializes an AggregationBucketAdjacencyMatrix structure.
+func (a *AggregationBucketAdjacencyMatrix) UnmarshalJSON(data []byte) error {
+ var aggs map[string]*json.RawMessage
+ if err := json.Unmarshal(data, &aggs); err != nil {
+ return err
+ }
+ if v, ok := aggs["buckets"]; ok && v != nil {
+ json.Unmarshal(*v, &a.Buckets)
+ }
+ if v, ok := aggs["meta"]; ok && v != nil {
+ json.Unmarshal(*v, &a.Meta)
+ }
+ a.Aggregations = aggs
+ return nil
+}
+
// -- Bucket histogram items --
// AggregationBucketHistogramItems is a bucket aggregation that is returned
@@ -1465,56 +1555,3 @@ func (a *AggregationPipelinePercentilesMetric) UnmarshalJSON(data []byte) error
a.Aggregations = aggs
return nil
}
-
-// -- Composite key items --
-
-// AggregationBucketCompositeItems implements the response structure
-// for a bucket aggregation of type composite.
-type AggregationBucketCompositeItems struct {
- Aggregations
-
- Buckets []*AggregationBucketCompositeItem //`json:"buckets"`
- Meta map[string]interface{} // `json:"meta,omitempty"`
-}
-
-// UnmarshalJSON decodes JSON data and initializes an AggregationBucketCompositeItems structure.
-func (a *AggregationBucketCompositeItems) UnmarshalJSON(data []byte) error {
- var aggs map[string]*json.RawMessage
- if err := json.Unmarshal(data, &aggs); err != nil {
- return err
- }
- if v, ok := aggs["buckets"]; ok && v != nil {
- json.Unmarshal(*v, &a.Buckets)
- }
- if v, ok := aggs["meta"]; ok && v != nil {
- json.Unmarshal(*v, &a.Meta)
- }
- a.Aggregations = aggs
- return nil
-}
-
-// AggregationBucketCompositeItem is a single bucket of an AggregationBucketCompositeItems structure.
-type AggregationBucketCompositeItem struct {
- Aggregations
-
- Key map[string]interface{} //`json:"key"`
- DocCount int64 //`json:"doc_count"`
-}
-
-// UnmarshalJSON decodes JSON data and initializes an AggregationBucketCompositeItem structure.
-func (a *AggregationBucketCompositeItem) UnmarshalJSON(data []byte) error {
- var aggs map[string]*json.RawMessage
- dec := json.NewDecoder(bytes.NewReader(data))
- dec.UseNumber()
- if err := dec.Decode(&aggs); err != nil {
- return err
- }
- if v, ok := aggs["key"]; ok && v != nil {
- json.Unmarshal(*v, &a.Key)
- }
- if v, ok := aggs["doc_count"]; ok && v != nil {
- json.Unmarshal(*v, &a.DocCount)
- }
- a.Aggregations = aggs
- return nil
-}