From 88d482437a39d0d45aeea19b372c9a9f768b9f40 Mon Sep 17 00:00:00 2001 From: Colin Goodheart-Smithe Date: Wed, 19 Aug 2015 14:31:30 +0100 Subject: [PATCH] Aggregations: Throw error if cardinality aggregator has a sub aggregation The cardinality aggregation is a metric aggregation and therefore cannot accept sub-aggregations. It was previously possible to create a rest request with a cardinality aggregation that had sub-aggregations. Now such a request will throw an error in the response. Close #12988 --- .../metrics/cardinality/CardinalityAggregatorFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java index 1e660f06f45..1b2d5fc1014 100644 --- a/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java +++ b/core/src/main/java/org/elasticsearch/search/aggregations/metrics/cardinality/CardinalityAggregatorFactory.java @@ -31,7 +31,7 @@ import java.io.IOException; import java.util.List; import java.util.Map; -final class CardinalityAggregatorFactory extends ValuesSourceAggregatorFactory { +final class CardinalityAggregatorFactory extends ValuesSourceAggregatorFactory.LeafOnly { private final long precisionThreshold;