diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java index 0e5b7a01658..e6def911c20 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStats.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -43,8 +42,8 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt /** per shard ctor */ InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + Map metadata) { + super(name, metadata); assert count >= 0; this.stats = multiFieldStatsResults; this.results = results; @@ -240,7 +239,7 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt // return empty result iff all stats are null if (aggs.isEmpty()) { - return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), pipelineAggregators(), getMetadata()); + return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), getMetadata()); } RunningStats runningStats = new RunningStats(); @@ -250,9 +249,9 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt if (reduceContext.isFinalReduce()) { MatrixStatsResults results = new MatrixStatsResults(runningStats); - return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, pipelineAggregators(), getMetadata()); + return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, getMetadata()); } - return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, pipelineAggregators(), getMetadata()); + return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, getMetadata()); } @Override diff --git a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java index ed121465b62..7dcc7e25b5b 100644 --- a/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java +++ b/modules/aggs-matrix-stats/src/main/java/org/elasticsearch/search/aggregations/matrix/stats/MatrixStatsAggregator.java @@ -126,12 +126,12 @@ final class MatrixStatsAggregator extends MetricsAggregator { if (valuesSources == null || bucket >= stats.size()) { return buildEmptyAggregation(); } - return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, pipelineAggregators(), metadata()); + return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalMatrixStats(name, 0, null, null, pipelineAggregators(), metadata()); + return new InternalMatrixStats(name, 0, null, null, metadata()); } @Override diff --git a/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java b/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java index c4044219bb0..457d4ef411f 100644 --- a/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java +++ b/modules/aggs-matrix-stats/src/test/java/org/elasticsearch/search/aggregations/matrix/stats/InternalMatrixStatsTests.java @@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.matrix.stats.InternalMatrixStats.Fields; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree; import org.elasticsearch.test.InternalAggregationTestCase; @@ -69,8 +68,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase pipelineAggregators, - Map metadata) { + protected InternalMatrixStats createTestInstance(String name, Map metadata) { double[] values = new double[fields.length]; for (int i = 0; i < fields.length; i++) { values[i] = randomDouble(); @@ -79,7 +77,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase metadata) { + this.name = name; + this.pipelineAggregators = emptyList(); + this.metadata = metadata; + } + + /** + * Constructs an aggregation result with a given name. + * + * @param name The name of the aggregation. + * @deprecated pipelines are being removed from the aggregation tree. Use the other ctor. + */ + @Deprecated protected InternalAggregation(String name, List pipelineAggregators, Map metadata) { this.name = name; this.pipelineAggregators = pipelineAggregators; @@ -171,6 +184,7 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable forEachBucket(bucketAggs -> bucketAggs.mergePipelineTreeForBWCSerialization(pipelineTree)); } + /** * Read from a stream. */ diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java b/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java index e3c1124df6b..0eae4612e30 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregation.java @@ -37,6 +37,14 @@ public abstract class InternalMultiBucketAggregation extends InternalAggregation implements MultiBucketsAggregation { + public InternalMultiBucketAggregation(String name, Map metadata) { + super(name, metadata); + } + + /** + * @deprecated being removed + */ + @Deprecated public InternalMultiBucketAggregation(String name, List pipelineAggregators, Map metadata) { super(name, pipelineAggregators, metadata); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FiltersAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FiltersAggregator.java index c7bb554c487..123e23d4e0c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FiltersAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/FiltersAggregator.java @@ -181,7 +181,7 @@ public class FiltersAggregator extends BucketsAggregator { bucketAggregations(bucketOrd), keyed); buckets.add(bucket); } - return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metadata()); + return new InternalFilters(name, buckets, keyed, metadata()); } @Override @@ -198,7 +198,7 @@ public class FiltersAggregator extends BucketsAggregator { buckets.add(bucket); } - return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metadata()); + return new InternalFilters(name, buckets, keyed, metadata()); } final long bucketOrd(long owningBucketOrdinal, int filterOrd) { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilters.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilters.java index 8be99e2f123..c7e359c3420 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilters.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFilters.java @@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -126,9 +125,8 @@ public class InternalFilters extends InternalMultiBucketAggregation bucketMap; - public InternalFilters(String name, List buckets, boolean keyed, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalFilters(String name, List buckets, boolean keyed, Map metadata) { + super(name, metadata); this.buckets = buckets; this.keyed = keyed; } @@ -164,7 +162,7 @@ public class InternalFilters extends InternalMultiBucketAggregation buckets) { - return new InternalFilters(this.name, buckets, this.keyed, this.pipelineAggregators(), this.metadata); + return new InternalFilters(name, buckets, keyed, metadata); } @Override @@ -209,8 +207,7 @@ public class InternalFilters extends InternalMultiBucketAggregation(bucketsList.size()), keyed, pipelineAggregators(), - getMetadata()); + InternalFilters reduced = new InternalFilters(name, new ArrayList<>(bucketsList.size()), keyed, getMetadata()); for (List sameRangeList : bucketsList) { reduced.buckets.add(reduceBucket(sameRangeList, reduceContext)); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java index 2fdec2db72a..6f4ca6ac67e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridAggregator.java @@ -95,8 +95,7 @@ public abstract class GeoGridAggregator extends Bucke }; } - abstract T buildAggregation(String name, int requiredSize, List buckets, - List pipelineAggregators, Map metadata); + abstract T buildAggregation(String name, int requiredSize, List buckets, Map metadata); /** * This method is used to return a re-usable instance of the bucket when building @@ -132,12 +131,12 @@ public abstract class GeoGridAggregator extends Bucke bucket.aggregations = bucketAggregations(bucket.bucketOrd); list[i] = bucket; } - return buildAggregation(name, requiredSize, Arrays.asList(list), pipelineAggregators(), metadata()); + return buildAggregation(name, requiredSize, Arrays.asList(list), metadata()); } @Override public InternalGeoGrid buildEmptyAggregation() { - return buildAggregation(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); + return buildAggregation(name, requiredSize, Collections.emptyList(), metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java index f816a204321..ce377524936 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregator.java @@ -43,13 +43,13 @@ public class GeoHashGridAggregator extends GeoGridAggregator buckets, - List pipelineAggregators, Map metadata) { - return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators, metadata); + Map metadata) { + return new InternalGeoHashGrid(name, requiredSize, buckets, metadata); } @Override public InternalGeoHashGrid buildEmptyAggregation() { - return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); + return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), metadata()); } InternalGeoGridBucket newEmptyBucket() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java index 6a1c3669a3e..3433ea6408b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoHashGridAggregatorFactory.java @@ -34,10 +34,11 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; + public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory { private final int precision; @@ -61,8 +62,7 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory< Aggregator parent, List pipelineAggregators, Map metadata) throws IOException { - final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, - Collections.emptyList(), pipelineAggregators, metadata); + final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, emptyList(), metadata); return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java index dde71a3bba1..93fb5f7e9ec 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregator.java @@ -44,13 +44,13 @@ public class GeoTileGridAggregator extends GeoGridAggregator buckets, - List pipelineAggregators, Map metadata) { - return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators, metadata); + Map metadata) { + return new InternalGeoTileGrid(name, requiredSize, buckets, metadata); } @Override public InternalGeoTileGrid buildEmptyAggregation() { - return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); + return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata()); } InternalGeoGridBucket newEmptyBucket() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregatorFactory.java index 30c11e150a9..f7123b7bbb8 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridAggregatorFactory.java @@ -60,8 +60,7 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory< Aggregator parent, List pipelineAggregators, Map metadata) throws IOException { - final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, - Collections.emptyList(), pipelineAggregators, metadata); + final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata); return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java index a89fa5b3846..c967787ed67 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoGrid.java @@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -48,9 +47,8 @@ public abstract class InternalGeoGrid protected final int requiredSize; protected final List buckets; - InternalGeoGrid(String name, int requiredSize, List buckets, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalGeoGrid(String name, int requiredSize, List buckets, Map metadata) { + super(name, metadata); this.requiredSize = requiredSize; this.buckets = buckets; } @@ -72,8 +70,7 @@ public abstract class InternalGeoGrid out.writeList(buckets); } - abstract InternalGeoGrid create(String name, int requiredSize, List buckets, - List pipelineAggregators, Map metadata); + abstract InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata); @Override public List getBuckets() { @@ -115,7 +112,7 @@ public abstract class InternalGeoGrid for (int i = ordered.size() - 1; i >= 0; i--) { list[i] = ordered.pop(); } - return create(getName(), requiredSize, Arrays.asList(list), pipelineAggregators(), getMetadata()); + return create(getName(), requiredSize, Arrays.asList(list), getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java index b9b1ce7b657..897ab16b6a5 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/geogrid/InternalGeoHashGrid.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -33,9 +32,8 @@ import java.util.Map; */ public class InternalGeoHashGrid extends InternalGeoGrid { - InternalGeoHashGrid(String name, int requiredSize, List buckets, - List pipelineAggregators, Map metadata) { - super(name, requiredSize, buckets, pipelineAggregators, metadata); + InternalGeoHashGrid(String name, int requiredSize, List buckets, Map metadata) { + super(name, requiredSize, buckets, metadata); } public InternalGeoHashGrid(StreamInput in) throws IOException { @@ -44,7 +42,7 @@ public class InternalGeoHashGrid extends InternalGeoGrid buckets) { - return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators(), metadata); + return new InternalGeoHashGrid(name, requiredSize, buckets, metadata); } @Override @@ -53,8 +51,8 @@ public class InternalGeoHashGrid extends InternalGeoGrid { - InternalGeoTileGrid(String name, int requiredSize, List buckets, - List pipelineAggregators, Map metadata) { - super(name, requiredSize, buckets, pipelineAggregators, metadata); + InternalGeoTileGrid(String name, int requiredSize, List buckets, Map metadata) { + super(name, requiredSize, buckets, metadata); } public InternalGeoTileGrid(StreamInput in) throws IOException { @@ -44,7 +42,7 @@ public class InternalGeoTileGrid extends InternalGeoGrid buckets) { - return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators(), metadata); + return new InternalGeoTileGrid(name, requiredSize, buckets, metadata); } @Override @@ -53,8 +51,8 @@ public class InternalGeoTileGrid extends InternalGeoGrid buckets, BucketOrder order, long minDocCount, long offset, - EmptyBucketInfo emptyBucketInfo, - DocValueFormat formatter, boolean keyed, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + EmptyBucketInfo emptyBucketInfo, DocValueFormat formatter, boolean keyed, Map metadata) { + super(name, metadata); this.buckets = buckets; this.order = order; this.offset = offset; @@ -284,8 +281,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation< @Override public InternalDateHistogram create(List buckets) { - return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, - keyed, pipelineAggregators(), metadata); + return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, keyed, metadata); } @Override @@ -467,7 +463,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation< } } return new InternalDateHistogram(getName(), reducedBuckets, order, minDocCount, offset, emptyBucketInfo, - format, keyed, pipelineAggregators(), getMetadata()); + format, keyed, getMetadata()); } @Override @@ -508,8 +504,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation< buckets2.add((Bucket) b); } buckets2 = Collections.unmodifiableList(buckets2); - return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format, - keyed, pipelineAggregators(), getMetadata()); + return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format, keyed, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java index e6937e4b13f..318ffec596b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogram.java @@ -32,7 +32,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -205,9 +204,8 @@ public final class InternalHistogram extends InternalMultiBucketAggregation buckets, BucketOrder order, long minDocCount, EmptyBucketInfo emptyBucketInfo, - DocValueFormat formatter, boolean keyed, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + DocValueFormat formatter, boolean keyed, Map metadata) { + super(name, metadata); this.buckets = buckets; this.order = order; assert (minDocCount == 0) == (emptyBucketInfo != null); @@ -266,7 +264,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation buckets) { - return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, pipelineAggregators(), metadata); + return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, metadata); } @Override @@ -439,8 +437,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation ranges, DocValueFormat formatter, boolean keyed, - List pipelineAggregators, Map metadata) { - return new InternalDateRange(name, ranges, formatter, keyed, pipelineAggregators, metadata); + Map metadata) { + return new InternalDateRange(name, ranges, formatter, keyed, metadata); } @Override public InternalDateRange create(List ranges, InternalDateRange prototype) { - return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(), - prototype.metadata); + return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata); + } @Override @@ -112,8 +111,8 @@ public class InternalDateRange extends InternalRange ranges, DocValueFormat formatter, boolean keyed, - List pipelineAggregators, Map metadata) { - super(name, ranges, formatter, keyed, pipelineAggregators, metadata); + Map metadata) { + super(name, ranges, formatter, keyed, metadata); } /** diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalGeoDistance.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalGeoDistance.java index 5154dbc5a24..14f0b097719 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalGeoDistance.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalGeoDistance.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; @@ -67,14 +66,13 @@ public class InternalGeoDistance extends InternalRange ranges, DocValueFormat format, boolean keyed, - List pipelineAggregators, Map metadata) { - return new InternalGeoDistance(name, ranges, keyed, pipelineAggregators, metadata); + Map metadata) { + return new InternalGeoDistance(name, ranges, keyed, metadata); } @Override public InternalGeoDistance create(List ranges, InternalGeoDistance prototype) { - return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.pipelineAggregators(), - prototype.metadata); + return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.metadata); } @Override @@ -90,10 +88,8 @@ public class InternalGeoDistance extends InternalRange ranges, boolean keyed, - List pipelineAggregators, - Map metadata) { - super(name, ranges, DocValueFormat.RAW, keyed, pipelineAggregators, metadata); + public InternalGeoDistance(String name, List ranges, boolean keyed, Map metadata) { + super(name, ranges, DocValueFormat.RAW, keyed, metadata); } /** diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java index 0c448fa0570..af185bed29c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/range/InternalRange.java @@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.support.CoreValuesSourceType; import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValuesSourceType; @@ -202,9 +201,8 @@ public class InternalRange ranges, DocValueFormat format, boolean keyed, List pipelineAggregators, - Map metadata) { - return (R) new InternalRange(name, ranges, format, keyed, pipelineAggregators, metadata); + public R create(String name, List ranges, DocValueFormat format, boolean keyed, Map metadata) { + return (R) new InternalRange(name, ranges, format, keyed, metadata); } @SuppressWarnings("unchecked") @@ -215,8 +213,7 @@ public class InternalRange ranges, R prototype) { - return (R) new InternalRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(), - prototype.metadata); + return (R) new InternalRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata); } @SuppressWarnings("unchecked") @@ -230,10 +227,8 @@ public class InternalRange ranges, DocValueFormat format, boolean keyed, - List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalRange(String name, List ranges, DocValueFormat format, boolean keyed, Map metadata) { + super(name, metadata); this.ranges = ranges; this.format = format; this.keyed = keyed; @@ -313,7 +308,7 @@ public class InternalRange extends NonCollectingAggregator { @@ -380,7 +380,7 @@ public class RangeAggregator extends BucketsAggregator { for (RangeAggregator.Range range : ranges) { buckets.add(factory.createBucket(range.key, range.from, range.to, 0, subAggs, keyed, format)); } - return factory.create(name, buckets, format, keyed, pipelineAggregators(), metadata()); + return factory.create(name, buckets, format, keyed, metadata()); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/GlobalOrdinalsSignificantTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/GlobalOrdinalsSignificantTermsAggregator.java index da0e4f82aba..b97e8390807 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/GlobalOrdinalsSignificantTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/GlobalOrdinalsSignificantTermsAggregator.java @@ -162,7 +162,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri } return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); + metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); } @Override @@ -172,7 +172,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri IndexReader topReader = searcher.getIndexReader(); int supersetSize = topReader.numDocs(); return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList()); + metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalMappedSignificantTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalMappedSignificantTerms.java index ace53282c9b..eaa008183f0 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalMappedSignificantTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalMappedSignificantTerms.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.Iterator; @@ -46,10 +45,10 @@ public abstract class InternalMappedSignificantTerms< protected final List buckets; protected Map bucketMap; - protected InternalMappedSignificantTerms(String name, int requiredSize, long minDocCount, List pipelineAggregators, + protected InternalMappedSignificantTerms(String name, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, long subsetSize, long supersetSize, SignificanceHeuristic significanceHeuristic, List buckets) { - super(name, requiredSize, minDocCount, pipelineAggregators, metadata); + super(name, requiredSize, minDocCount, metadata); this.format = format; this.buckets = buckets; this.subsetSize = subsetSize; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTerms.java index 8c3309b5c50..3e889b8664e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTerms.java @@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -166,9 +165,8 @@ public abstract class InternalSignificantTerms pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + protected InternalSignificantTerms(String name, int requiredSize, long minDocCount, Map metadata) { + super(name, metadata); this.requiredSize = requiredSize; this.minDocCount = minDocCount; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTerms.java index 15b954e79ea..52f18fb7467 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTerms.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -101,10 +100,10 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms pipelineAggregators, + public SignificantLongTerms(String name, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, long subsetSize, long supersetSize, SignificanceHeuristic significanceHeuristic, List buckets) { - super(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, supersetSize, significanceHeuristic, + super(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -122,7 +121,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms buckets) { - return new SignificantLongTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata, format, subsetSize, supersetSize, + return new SignificantLongTerms(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -134,7 +133,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms buckets) { - return new SignificantLongTerms(getName(), requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, subsetSize, + return new SignificantLongTerms(getName(), requiredSize, minDocCount, getMetadata(), format, subsetSize, supersetSize, significanceHeuristic, buckets); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsAggregator.java index c8b707db65f..32e1f2ed05e 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsAggregator.java @@ -121,7 +121,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator { } return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); + metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); } @Override @@ -131,7 +131,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator { IndexReader topReader = searcher.getIndexReader(); int supersetSize = topReader.numDocs(); return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); + metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTerms.java index 024b6064565..823b8fea2b1 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTerms.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -106,11 +105,10 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms pipelineAggregators, + public SignificantStringTerms(String name, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, long subsetSize, long supersetSize, SignificanceHeuristic significanceHeuristic, List buckets) { - super(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, supersetSize, significanceHeuristic, - buckets); + super(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } /** @@ -127,7 +125,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms buckets) { - return new SignificantStringTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata, format, subsetSize, + return new SignificantStringTerms(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -139,7 +137,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms buckets) { - return new SignificantStringTerms(getName(), requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, subsetSize, + return new SignificantStringTerms(getName(), requiredSize, minDocCount, getMetadata(), format, subsetSize, supersetSize, significanceHeuristic, buckets); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsAggregator.java index 164567dab41..2482d16c2dc 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsAggregator.java @@ -130,7 +130,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator { } return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(), - bucketCountThresholds.getMinDocCount(), pipelineAggregators(), + bucketCountThresholds.getMinDocCount(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); } @@ -141,7 +141,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator { IndexReader topReader = searcher.getIndexReader(); int supersetSize = topReader.numDocs(); return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); + metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java index eadb414e66f..e87414edd4a 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTermsAggregatorFactory.java @@ -167,7 +167,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac List pipelineAggregators, Map metadata) throws IOException { final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(), - bucketCountThresholds.getMinDocCount(), pipelineAggregators, metadata); + bucketCountThresholds.getMinDocCount(), metadata); return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTextAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTextAggregator.java index ea29f6cc0f6..5d81ba80f77 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTextAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantTextAggregator.java @@ -232,7 +232,7 @@ public class SignificantTextAggregator extends BucketsAggregator { } return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(), - bucketCountThresholds.getMinDocCount(), pipelineAggregators(), + bucketCountThresholds.getMinDocCount(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); } @@ -244,7 +244,7 @@ public class SignificantTextAggregator extends BucketsAggregator { IndexReader topReader = searcher.getIndexReader(); int supersetSize = topReader.numDocs(); return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); + metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/UnmappedSignificantTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/UnmappedSignificantTerms.java index 608cb88679c..4569bdf1497 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/UnmappedSignificantTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/significant/UnmappedSignificantTerms.java @@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.terms.InternalTerms; import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.Iterator; @@ -56,9 +55,8 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms pipelineAggregators, - Map metadata) { - super(name, requiredSize, minDocCount, pipelineAggregators, metadata); + public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, Map metadata) { + super(name, requiredSize, minDocCount, metadata); } /** @@ -85,7 +83,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms buckets) { - return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata); + return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata); } @Override @@ -106,7 +104,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms aggregations, ReduceContext reduceContext) { - return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata); + return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/AbstractStringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/AbstractStringTermsAggregator.java index 7612bf60f9b..a095c75e3be 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/AbstractStringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/AbstractStringTermsAggregator.java @@ -22,9 +22,9 @@ package org.elasticsearch.search.aggregations.bucket.terms; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; -import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.internal.SearchContext; import java.io.IOException; @@ -47,7 +47,7 @@ abstract class AbstractStringTermsAggregator extends TermsAggregator { @Override public InternalAggregation buildEmptyAggregation() { return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0); + metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTerms.java index 125ebff3092..b2362360466 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTerms.java @@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; +import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; -import org.elasticsearch.search.aggregations.BucketOrder; import java.io.IOException; import java.util.ArrayList; @@ -101,10 +100,10 @@ public class DoubleTerms extends InternalMappedTerms pipelineAggregators, + public DoubleTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, List buckets, long docCountError) { - super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, shardSize, showTermDocCountError, + super(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -122,7 +121,7 @@ public class DoubleTerms extends InternalMappedTerms buckets) { - return new DoubleTerms(name, order, requiredSize, minDocCount, this.pipelineAggregators(), metadata, format, shardSize, + return new DoubleTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -134,7 +133,7 @@ public class DoubleTerms extends InternalMappedTerms buckets, long docCountError, long otherDocCount) { - return new DoubleTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, + return new DoubleTerms(name, order, requiredSize, minDocCount, getMetadata(), format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java index f1faf4774d3..0e4148d1792 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsAggregator.java @@ -65,7 +65,7 @@ public class DoubleTermsAggregator extends LongTermsAggregator { private static DoubleTerms convertToDouble(LongTerms terms) { List buckets = terms.buckets.stream().map(DoubleTermsAggregator::convertToDouble).collect(Collectors.toList()); - return new DoubleTerms(terms.getName(), terms.order, terms.requiredSize, terms.minDocCount, terms.pipelineAggregators(), + return new DoubleTerms(terms.getName(), terms.order, terms.requiredSize, terms.minDocCount, terms.getMetadata(), terms.format, terms.shardSize, terms.showTermDocCountError, terms.otherDocCount, buckets, terms.docCountError); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java index 8884eb65174..076e4abc0b1 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/GlobalOrdinalsStringTermsAggregator.java @@ -240,7 +240,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr } return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, + metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount, Arrays.asList(list), 0); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalMappedTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalMappedTerms.java index 6a88c73affa..b4cf16d504c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalMappedTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalMappedTerms.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.BucketOrder; import java.io.IOException; @@ -47,9 +46,9 @@ public abstract class InternalMappedTerms, B exten protected long docCountError; protected InternalMappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, - List pipelineAggregators, Map metadata, DocValueFormat format, int shardSize, + Map metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, List buckets, long docCountError) { - super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); + super(name, order, requiredSize, minDocCount, metadata); this.format = format; this.shardSize = shardSize; this.showTermDocCountError = showTermDocCountError; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java index eefce73f327..05303ffad2f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTerms.java @@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.KeyComparable; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -157,9 +156,8 @@ public abstract class InternalTerms, B extends Int protected final int requiredSize; protected final long minDocCount; - protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map metadata) { + super(name, metadata); this.order = order; this.requiredSize = requiredSize; this.minDocCount = minDocCount; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTerms.java index c24e08fe854..8b3a1d00a67 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTerms.java @@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; +import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; -import org.elasticsearch.search.aggregations.BucketOrder; import java.io.IOException; import java.util.ArrayList; @@ -101,10 +100,10 @@ public class LongTerms extends InternalMappedTerms } } - public LongTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List pipelineAggregators, + public LongTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, List buckets, long docCountError) { - super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, shardSize, showTermDocCountError, + super(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -122,7 +121,7 @@ public class LongTerms extends InternalMappedTerms @Override public LongTerms create(List buckets) { - return new LongTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata, format, shardSize, + return new LongTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -134,7 +133,7 @@ public class LongTerms extends InternalMappedTerms @Override protected LongTerms create(String name, List buckets, long docCountError, long otherDocCount) { - return new LongTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, shardSize, + return new LongTerms(name, order, requiredSize, minDocCount, getMetadata(), format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -170,7 +169,7 @@ public class LongTerms extends InternalMappedTerms longTerms.showTermDocCountError ? bucket.getDocCountError() : 0, decimalFormat)); } return new DoubleTerms(longTerms.getName(), longTerms.order, longTerms.requiredSize, - longTerms.minDocCount, longTerms.pipelineAggregators(), + longTerms.minDocCount, longTerms.metadata, longTerms.format, longTerms.shardSize, longTerms.showTermDocCountError, longTerms.otherDocCount, newBuckets, longTerms.docCountError); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java index 7ff08618732..720e43c4d96 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsAggregator.java @@ -26,13 +26,13 @@ import org.elasticsearch.common.util.LongHash; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.AggregatorFactories; +import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregation; +import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; -import org.elasticsearch.search.aggregations.BucketOrder; -import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.internal.SearchContext; @@ -169,14 +169,14 @@ public class LongTermsAggregator extends TermsAggregator { } return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount, + metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount, Arrays.asList(list), 0); } @Override public InternalAggregation buildEmptyAggregation() { return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0); + metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTerms.java index a71345d64cd..995b85768d8 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTerms.java @@ -23,9 +23,8 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.BucketOrder; +import org.elasticsearch.search.aggregations.InternalAggregations; import java.io.IOException; import java.util.List; @@ -104,10 +103,10 @@ public class StringTerms extends InternalMappedTerms pipelineAggregators, + public StringTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, List buckets, long docCountError) { - super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, + super(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -125,7 +124,7 @@ public class StringTerms extends InternalMappedTerms buckets) { - return new StringTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata, format, shardSize, + return new StringTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -142,7 +141,7 @@ public class StringTerms extends InternalMappedTerms buckets, long docCountError, long otherDocCount) { - return new StringTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, shardSize, + return new StringTerms(name, order, requiredSize, minDocCount, getMetadata(), format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java index a731685ab1b..e51f8d5a8b1 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsAggregator.java @@ -176,7 +176,7 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator { } return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), - pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount, + metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount, Arrays.asList(list), 0); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java index a4eb231471a..1118d6e9bb8 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/TermsAggregatorFactory.java @@ -86,7 +86,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory pipelineAggregators, Map metadata) throws IOException { final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(), - bucketCountThresholds.getMinDocCount(), pipelineAggregators, metadata); + bucketCountThresholds.getMinDocCount(), metadata); Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) { @Override public InternalAggregation buildEmptyAggregation() { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedTerms.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedTerms.java index 5672180b257..701d0928ea6 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedTerms.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/terms/UnmappedTerms.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.Collections; @@ -51,9 +50,8 @@ public class UnmappedTerms extends InternalTerms pipelineAggregators, Map metadata) { - super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); + public UnmappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map metadata) { + super(name, order, requiredSize, minDocCount, metadata); } /** @@ -80,7 +78,7 @@ public class UnmappedTerms extends InternalTerms buckets) { - return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata); + return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata); } @Override @@ -100,7 +98,7 @@ public class UnmappedTerms extends InternalTerms aggregations, ReduceContext reduceContext) { - return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata); + return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AbstractInternalHDRPercentiles.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AbstractInternalHDRPercentiles.java index 4bb4d7aa73a..94596cb6e5f 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AbstractInternalHDRPercentiles.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AbstractInternalHDRPercentiles.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.nio.ByteBuffer; @@ -42,9 +41,8 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr protected final boolean keyed; AbstractInternalHDRPercentiles(String name, double[] keys, DoubleHistogram state, boolean keyed, DocValueFormat format, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + super(name, metadata); this.keys = keys; this.state = state; this.keyed = keyed; @@ -113,11 +111,11 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr } merged.add(percentiles.state); } - return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetadata()); + return createReduced(getName(), keys, merged, keyed, getMetadata()); } protected abstract AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed, - List pipelineAggregators, Map metadata); + Map metadata); @Override public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AvgAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AvgAggregator.java index 5fd9f9b5d5e..608fc8f6fea 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AvgAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/AvgAggregator.java @@ -117,12 +117,12 @@ class AvgAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSource == null || bucket >= sums.size()) { return buildEmptyAggregation(); } - return new InternalAvg(name, sums.get(bucket), counts.get(bucket), format, pipelineAggregators(), metadata()); + return new InternalAvg(name, sums.get(bucket), counts.get(bucket), format, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata()); + return new InternalAvg(name, 0.0, 0L, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregator.java index a04788f00ce..6b414c70f11 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/CardinalityAggregator.java @@ -150,12 +150,12 @@ class CardinalityAggregator extends NumericMetricsAggregator.SingleValue { // this Aggregator (and its HLL++ counters) is released. HyperLogLogPlusPlus copy = new HyperLogLogPlusPlus(precision, BigArrays.NON_RECYCLING_INSTANCE, 1); copy.merge(0, counts, owningBucketOrdinal); - return new InternalCardinality(name, copy, pipelineAggregators(), metadata()); + return new InternalCardinality(name, copy, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalCardinality(name, null, pipelineAggregators(), metadata()); + return new InternalCardinality(name, null, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregator.java index 43ead743985..17617f01646 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ExtendedStatsAggregator.java @@ -205,13 +205,12 @@ class ExtendedStatsAggregator extends NumericMetricsAggregator.MultiValue { } return new InternalExtendedStats(name, counts.get(bucket), sums.get(bucket), mins.get(bucket), maxes.get(bucket), sumOfSqrs.get(bucket), sigma, format, - pipelineAggregators(), metadata()); + metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d, - sigma, format, pipelineAggregators(), metadata()); + return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d, sigma, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksAggregator.java index 3324c3897cc..df479fc344d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentileRanksAggregator.java @@ -45,7 +45,7 @@ class HDRPercentileRanksAggregator extends AbstractHDRPercentilesAggregator { if (state == null) { return buildEmptyAggregation(); } else { - return new InternalHDRPercentileRanks(name, keys, state, keyed, format, pipelineAggregators(), metadata()); + return new InternalHDRPercentileRanks(name, keys, state, keyed, format, metadata()); } } @@ -54,8 +54,7 @@ class HDRPercentileRanksAggregator extends AbstractHDRPercentilesAggregator { DoubleHistogram state; state = new DoubleHistogram(numberOfSignificantValueDigits); state.setAutoResize(true); - return new InternalHDRPercentileRanks(name, keys, state, - keyed, format, pipelineAggregators(), metadata()); + return new InternalHDRPercentileRanks(name, keys, state, keyed, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesAggregator.java index b4059fd11d4..017ecc02ac1 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/HDRPercentilesAggregator.java @@ -45,7 +45,7 @@ class HDRPercentilesAggregator extends AbstractHDRPercentilesAggregator { if (state == null) { return buildEmptyAggregation(); } else { - return new InternalHDRPercentiles(name, keys, state, keyed, format, pipelineAggregators(), metadata()); + return new InternalHDRPercentiles(name, keys, state, keyed, format, metadata()); } } @@ -64,8 +64,6 @@ class HDRPercentilesAggregator extends AbstractHDRPercentilesAggregator { DoubleHistogram state; state = new DoubleHistogram(numberOfSignificantValueDigits); state.setAutoResize(true); - return new InternalHDRPercentiles(name, keys, state, - keyed, - format, pipelineAggregators(), metadata()); + return new InternalHDRPercentiles(name, keys, state, keyed, format, metadata()); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalAvg.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalAvg.java index b1988cf7d5e..746888a67ee 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalAvg.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalAvg.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -34,9 +33,8 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i private final double sum; private final long count; - public InternalAvg(String name, double sum, long count, DocValueFormat format, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalAvg(String name, double sum, long count, DocValueFormat format, Map metadata) { + super(name, metadata); this.sum = sum; this.count = count; this.format = format; @@ -97,7 +95,7 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i count += avg.count; kahanSummation.add(avg.sum); } - return new InternalAvg(getName(), kahanSummation.value(), count, format, pipelineAggregators(), getMetadata()); + return new InternalAvg(getName(), kahanSummation.value(), count, format, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalCardinality.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalCardinality.java index 80cfca671bb..c959d000b27 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalCardinality.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalCardinality.java @@ -25,7 +25,6 @@ import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -35,9 +34,8 @@ import java.util.Objects; public final class InternalCardinality extends InternalNumericMetricsAggregation.SingleValue implements Cardinality { private final HyperLogLogPlusPlus counts; - InternalCardinality(String name, HyperLogLogPlusPlus counts, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalCardinality(String name, HyperLogLogPlusPlus counts, Map metadata) { + super(name, metadata); this.counts = counts; } @@ -92,7 +90,7 @@ public final class InternalCardinality extends InternalNumericMetricsAggregation if (cardinality.counts != null) { if (reduced == null) { reduced = new InternalCardinality(name, new HyperLogLogPlusPlus(cardinality.counts.precision(), - BigArrays.NON_RECYCLING_INSTANCE, 1), pipelineAggregators(), getMetadata()); + BigArrays.NON_RECYCLING_INSTANCE, 1), getMetadata()); } reduced.merge(cardinality); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStats.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStats.java index 2dd5ee8e9f1..5e09a1c3766 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStats.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalExtendedStats.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -44,8 +43,8 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat private final double sigma; public InternalExtendedStats(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma, - DocValueFormat formatter, List pipelineAggregators, Map metadata) { - super(name, count, sum, min, max, formatter, pipelineAggregators, metadata); + DocValueFormat formatter, Map metadata) { + super(name, count, sum, min, max, formatter, metadata); this.sumOfSqrs = sumOfSqrs; this.sigma = sigma; } @@ -160,7 +159,7 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat } final InternalStats stats = super.reduce(aggregations, reduceContext); return new InternalExtendedStats(name, stats.getCount(), stats.getSum(), stats.getMin(), stats.getMax(), sumOfSqrs, sigma, - format, pipelineAggregators(), getMetadata()); + format, getMetadata()); } static class Fields { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentileRanks.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentileRanks.java index 96e3106b9c6..2a5e5a97ac6 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentileRanks.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentileRanks.java @@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics; import org.HdrHistogram.DoubleHistogram; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.Iterator; -import java.util.List; import java.util.Map; public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles implements PercentileRanks { public static final String NAME = "hdr_percentile_ranks"; InternalHDRPercentileRanks(String name, double[] cdfValues, DoubleHistogram state, boolean keyed, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, cdfValues, state, keyed, formatter, pipelineAggregators, metadata); + Map metadata) { + super(name, cdfValues, state, keyed, formatter, metadata); } /** @@ -70,8 +68,8 @@ public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles i @Override protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed, - List pipelineAggregators, Map metadata) { - return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, pipelineAggregators, metadata); + Map metadata) { + return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, metadata); } static double percentileRank(DoubleHistogram state, double value) { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentiles.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentiles.java index dc7f773ef81..a53d162ef9a 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentiles.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentiles.java @@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics; import org.HdrHistogram.DoubleHistogram; import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.Iterator; -import java.util.List; import java.util.Map; public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles implements Percentiles { public static final String NAME = "hdr_percentiles"; InternalHDRPercentiles(String name, double[] percents, DoubleHistogram state, boolean keyed, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, percents, state, keyed, formatter, pipelineAggregators, metadata); + Map metadata) { + super(name, percents, state, keyed, formatter, metadata); } /** @@ -73,8 +71,8 @@ public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles imple @Override protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed, - List pipelineAggregators, Map metadata) { - return new InternalHDRPercentiles(name, keys, merged, keyed, format, pipelineAggregators, metadata); + Map metadata) { + return new InternalHDRPercentiles(name, keys, merged, keyed, format, metadata); } public static class Iter implements Iterator { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMax.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMax.java index 17234e2ce74..044452d0704 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMax.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMax.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -33,9 +32,8 @@ import java.util.Objects; public class InternalMax extends InternalNumericMetricsAggregation.SingleValue implements Max { private final double max; - public InternalMax(String name, double max, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalMax(String name, double max, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.format = formatter; this.max = max; } @@ -76,7 +74,7 @@ public class InternalMax extends InternalNumericMetricsAggregation.SingleValue i for (InternalAggregation aggregation : aggregations) { max = Math.max(max, ((InternalMax) aggregation).max); } - return new InternalMax(name, max, format, pipelineAggregators(), getMetadata()); + return new InternalMax(name, max, format, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviation.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviation.java index 1ceca2bb69f..17b2a2f1225 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviation.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviation.java @@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -52,13 +51,8 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre private final TDigestState valuesSketch; private final double medianAbsoluteDeviation; - InternalMedianAbsoluteDeviation(String name, - List pipelineAggregators, - Map metadata, - DocValueFormat format, - TDigestState valuesSketch) { - - super(name, pipelineAggregators, metadata); + InternalMedianAbsoluteDeviation(String name, Map metadata, DocValueFormat format, TDigestState valuesSketch) { + super(name, metadata); this.format = Objects.requireNonNull(format); this.valuesSketch = Objects.requireNonNull(valuesSketch); @@ -87,7 +81,7 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre valueMerged.add(madAggregation.valuesSketch); } - return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata, format, valueMerged); + return new InternalMedianAbsoluteDeviation(name, metadata, format, valueMerged); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMin.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMin.java index e2fff2672fb..23aacd62047 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMin.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalMin.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -33,9 +32,8 @@ import java.util.Objects; public class InternalMin extends InternalNumericMetricsAggregation.SingleValue implements Min { private final double min; - public InternalMin(String name, double min, DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalMin(String name, double min, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.min = min; this.format = formatter; } @@ -76,7 +74,7 @@ public class InternalMin extends InternalNumericMetricsAggregation.SingleValue i for (InternalAggregation aggregation : aggregations) { min = Math.min(min, ((InternalMin) aggregation).min); } - return new InternalMin(getName(), min, this.format, pipelineAggregators(), getMetadata()); + return new InternalMin(getName(), min, this.format, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java index a03e733002e..57bc6ebe812 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalNumericMetricsAggregation.java @@ -37,8 +37,8 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat protected DocValueFormat format = DEFAULT_FORMAT; public abstract static class SingleValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.SingleValue { - protected SingleValue(String name, List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + protected SingleValue(String name, Map metadata) { + super(name, metadata); } /** @@ -76,6 +76,14 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat } public abstract static class MultiValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.MultiValue { + protected MultiValue(String name, Map metadata) { + super(name, metadata); + } + + /** + * @deprecated prefer the other ctor, the pipeline aggregators aren't used + */ + @Deprecated protected MultiValue(String name, List pipelineAggregators, Map metadata) { super(name, pipelineAggregators, metadata); } @@ -113,8 +121,16 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat } } + private InternalNumericMetricsAggregation(String name, Map metadata) { + super(name, metadata); + } + + /** + * @deprecated prefer the other ctor, the pipeline aggregators aren't used + */ + @Deprecated private InternalNumericMetricsAggregation(String name, List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + super(name, metadata); } /** diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalStats.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalStats.java index 4c0a9df6270..cb4ad8239ec 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalStats.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalStats.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -46,8 +45,8 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue protected final double sum; public InternalStats(String name, long count, double sum, double min, double max, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + Map metadata) { + super(name, metadata); this.count = count; this.sum = sum; this.min = min; @@ -160,7 +159,7 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue // accurate than naive summation. kahanSummation.add(stats.getSum()); } - return new InternalStats(name, count, kahanSummation.value(), min, max, format, pipelineAggregators(), getMetadata()); + return new InternalStats(name, count, kahanSummation.value(), min, max, format, getMetadata()); } static class Fields { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalSum.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalSum.java index 11f6fb0fbe7..65a201d1e75 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalSum.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalSum.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -33,9 +32,8 @@ import java.util.Objects; public class InternalSum extends InternalNumericMetricsAggregation.SingleValue implements Sum { private final double sum; - InternalSum(String name, double sum, DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalSum(String name, double sum, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.sum = sum; this.format = formatter; } @@ -79,7 +77,7 @@ public class InternalSum extends InternalNumericMetricsAggregation.SingleValue i double value = ((InternalSum) aggregation).sum; kahanSummation.add(value); } - return new InternalSum(name, kahanSummation.value(), format, pipelineAggregators(), getMetadata()); + return new InternalSum(name, kahanSummation.value(), format, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalValueCount.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalValueCount.java index ae0e94b8a2d..38b82ad97dd 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalValueCount.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalValueCount.java @@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -35,9 +34,8 @@ import java.util.Objects; public class InternalValueCount extends InternalNumericMetricsAggregation.SingleValue implements ValueCount { private final long value; - InternalValueCount(String name, long value, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalValueCount(String name, long value, Map metadata) { + super(name, metadata); this.value = value; } @@ -75,7 +73,7 @@ public class InternalValueCount extends InternalNumericMetricsAggregation.Single for (InternalAggregation aggregation : aggregations) { valueCount += ((InternalValueCount) aggregation).value; } - return new InternalValueCount(name, valueCount, pipelineAggregators(), getMetadata()); + return new InternalValueCount(name, valueCount, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalWeightedAvg.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalWeightedAvg.java index fd3db3019fb..69f441d5a19 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalWeightedAvg.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/InternalWeightedAvg.java @@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -34,9 +33,8 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl private final double sum; private final double weight; - InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, Map metadata) { + super(name, metadata); this.sum = sum; this.weight = weight; this.format = format; @@ -99,8 +97,7 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl sumCompensation.add(avg.sum); } - return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(), - format, pipelineAggregators(), getMetadata()); + return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(), format, getMetadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregator.java index 7454f0bd39d..f2fb9cd0816 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MaxAggregator.java @@ -146,12 +146,12 @@ class MaxAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSource == null || bucket >= maxes.size()) { return buildEmptyAggregation(); } - return new InternalMax(name, maxes.get(bucket), formatter, pipelineAggregators(), metadata()); + return new InternalMax(name, maxes.get(bucket), formatter, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, pipelineAggregators(), metadata()); + return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java index c1081b27daf..d3ab461dcd9 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MedianAbsoluteDeviationAggregator.java @@ -126,7 +126,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator. public InternalAggregation buildAggregation(long bucket) throws IOException { if (hasDataForBucket(bucket)) { final TDigestState valueSketch = valueSketches.get(bucket); - return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, valueSketch); + return new InternalMedianAbsoluteDeviation(name, metadata(), format, valueSketch); } else { return buildEmptyAggregation(); } @@ -134,7 +134,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator. @Override public InternalAggregation buildEmptyAggregation() { - return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, new TDigestState(compression)); + return new InternalMedianAbsoluteDeviation(name, metadata(), format, new TDigestState(compression)); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MinAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MinAggregator.java index ed9aff92bd6..8aff0ce2306 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MinAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/MinAggregator.java @@ -149,12 +149,12 @@ class MinAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSource == null || bucket >= mins.size()) { return buildEmptyAggregation(); } - return new InternalMin(name, mins.get(bucket), format, pipelineAggregators(), metadata()); + return new InternalMin(name, mins.get(bucket), format, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalMin(name, Double.POSITIVE_INFINITY, format, pipelineAggregators(), metadata()); + return new InternalMin(name, Double.POSITIVE_INFINITY, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/StatsAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/StatsAggregator.java index 9edef8f8425..5da83c24b18 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/StatsAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/StatsAggregator.java @@ -164,12 +164,12 @@ class StatsAggregator extends NumericMetricsAggregator.MultiValue { return buildEmptyAggregation(); } return new InternalStats(name, counts.get(bucket), sums.get(bucket), mins.get(bucket), - maxes.get(bucket), format, pipelineAggregators(), metadata()); + maxes.get(bucket), format, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalStats(name, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, format, pipelineAggregators(), metadata()); + return new InternalStats(name, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/SumAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/SumAggregator.java index d2d5e212fae..7d1247c6632 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/SumAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/SumAggregator.java @@ -109,12 +109,12 @@ class SumAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSource == null || bucket >= sums.size()) { return buildEmptyAggregation(); } - return new InternalSum(name, sums.get(bucket), format, pipelineAggregators(), metadata()); + return new InternalSum(name, sums.get(bucket), format, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalSum(name, 0.0, format, pipelineAggregators(), metadata()); + return new InternalSum(name, 0.0, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregator.java index db3aac0d468..0b0952b38ba 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/ValueCountAggregator.java @@ -90,12 +90,12 @@ class ValueCountAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSource == null || bucket >= counts.size()) { return buildEmptyAggregation(); } - return new InternalValueCount(name, counts.get(bucket), pipelineAggregators(), metadata()); + return new InternalValueCount(name, counts.get(bucket), metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalValueCount(name, 0L, pipelineAggregators(), metadata()); + return new InternalValueCount(name, 0L, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/WeightedAvgAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/WeightedAvgAggregator.java index e4316006e01..dfa40a55b2d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/metrics/WeightedAvgAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/metrics/WeightedAvgAggregator.java @@ -140,12 +140,12 @@ class WeightedAvgAggregator extends NumericMetricsAggregator.SingleValue { if (valuesSources == null || bucket >= valueSums.size()) { return buildEmptyAggregation(); } - return new InternalWeightedAvg(name, valueSums.get(bucket), weights.get(bucket), format, pipelineAggregators(), metadata()); + return new InternalWeightedAvg(name, valueSums.get(bucket), weights.get(bucket), format, metadata()); } @Override public InternalAggregation buildEmptyAggregation() { - return new InternalWeightedAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata()); + return new InternalWeightedAvg(name, 0.0, 0L, format, metadata()); } @Override diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketPipelineAggregator.java index 671b21b7df4..8a6bbdcc14b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/AvgBucketPipelineAggregator.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; -import java.util.List; import java.util.Map; public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator { @@ -62,9 +61,9 @@ public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { + protected InternalAggregation buildAggregation(Map metadata) { double avgValue = count == 0 ? Double.NaN : (sum / count); - return new InternalSimpleValue(name(), avgValue, format, pipelineAggregators, metadata); + return new InternalSimpleValue(name(), avgValue, format, metadata); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketMetricsPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketMetricsPipelineAggregator.java index 5b9b818ad23..aa45cf14e22 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketMetricsPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketMetricsPipelineAggregator.java @@ -27,14 +27,10 @@ import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation.ReduceContext; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.BucketHelpers; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; -import org.elasticsearch.search.aggregations.pipeline.SiblingPipelineAggregator; import org.elasticsearch.search.aggregations.support.AggregationPath; import java.io.IOException; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -90,7 +86,7 @@ public abstract class BucketMetricsPipelineAggregator extends SiblingPipelineAgg } } } - return buildAggregation(Collections.emptyList(), metadata()); + return buildAggregation(metadata()); } /** @@ -104,12 +100,10 @@ public abstract class BucketMetricsPipelineAggregator extends SiblingPipelineAgg * Called after a collection run is finished to build the aggregation for * the collected state. * - * @param pipelineAggregators - * the pipeline aggregators to add to the resulting aggregation * @param metadata * the metadata to add to the resulting aggregation */ - protected abstract InternalAggregation buildAggregation(List pipelineAggregators, Map metadata); + protected abstract InternalAggregation buildAggregation(Map metadata); /** * Called for each bucket with a value so the state can be modified based on diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptPipelineAggregator.java index f9e18c600b1..7d9a0395616 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/BucketScriptPipelineAggregator.java @@ -115,8 +115,7 @@ public class BucketScriptPipelineAggregator extends PipelineAggregator { final List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map( (p) -> (InternalAggregation) p).collect(Collectors.toList()); - InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(), - formatter, new ArrayList<>(), metadata()); + InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(), formatter, metadata()); aggs.add(simpleValue); InternalMultiBucketAggregation.InternalBucket newBucket = originalAgg.createBucket(new InternalAggregations(aggs), bucket); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/CumulativeSumPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/CumulativeSumPipelineAggregator.java index 6c8b45058d2..5af6fb5e36c 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/CumulativeSumPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/CumulativeSumPipelineAggregator.java @@ -86,7 +86,7 @@ public class CumulativeSumPipelineAggregator extends PipelineAggregator { List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) .map((p) -> (InternalAggregation) p) .collect(Collectors.toList()); - aggs.add(new InternalSimpleValue(name(), sum, formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), sum, formatter, metadata())); Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); newBuckets.add(newBucket); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/DerivativePipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/DerivativePipelineAggregator.java index 4d07c9d518e..d603202586d 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/DerivativePipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/DerivativePipelineAggregator.java @@ -97,7 +97,7 @@ public class DerivativePipelineAggregator extends PipelineAggregator { final List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map((p) -> { return (InternalAggregation) p; }).collect(Collectors.toList()); - aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, new ArrayList(), metadata())); + aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, metadata())); Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); newBuckets.add(newBucket); } else { diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketPipelineAggregator.java index 1e8029e4a19..28d38049547 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/ExtendedStatsBucketPipelineAggregator.java @@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; -import java.util.List; import java.util.Map; public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator { @@ -80,7 +79,7 @@ public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipeline } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { - return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, pipelineAggregators, metadata); + protected InternalAggregation buildAggregation(Map metadata) { + return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, metadata); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalBucketMetricValue.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalBucketMetricValue.java index 22c3ae892dc..230701cf093 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalBucketMetricValue.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalBucketMetricValue.java @@ -40,9 +40,8 @@ public class InternalBucketMetricValue extends InternalNumericMetricsAggregation private double value; private String[] keys; - public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.keys = keys; this.value = value; this.format = formatter; diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivative.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivative.java index be48e318bb3..7f022faad77 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivative.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivative.java @@ -32,9 +32,8 @@ import java.util.Objects; public class InternalDerivative extends InternalSimpleValue implements Derivative { private final double normalizationFactor; - InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, value, formatter, pipelineAggregators, metadata); + InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter, Map metadata) { + super(name, value, formatter, metadata); this.normalizationFactor = normalizationFactor; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalExtendedStatsBucket.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalExtendedStatsBucket.java index df984e20e3a..b45bffbed0b 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalExtendedStatsBucket.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalExtendedStatsBucket.java @@ -30,9 +30,8 @@ import java.util.Map; public class InternalExtendedStatsBucket extends InternalExtendedStats implements ExtendedStatsBucket { InternalExtendedStatsBucket(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma, - DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, pipelineAggregators, metadata); + DocValueFormat formatter, Map metadata) { + super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, metadata); } /** diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucket.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucket.java index e6ed5bd4625..29801af12a5 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucket.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucket.java @@ -44,9 +44,8 @@ public class InternalPercentilesBucket extends InternalNumericMetricsAggregation private final transient Map percentileLookups = new HashMap<>(); InternalPercentilesBucket(String name, double[] percents, double[] percentiles, boolean keyed, - DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + DocValueFormat formatter, Map metadata) { + super(name, metadata); if ((percentiles.length == percents.length) == false) { throw new IllegalArgumentException("The number of provided percents and percentiles didn't match. percents: " + Arrays.toString(percents) + ", percentiles: " + Arrays.toString(percentiles)); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValue.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValue.java index 517f8ee19d0..71bf9450f03 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValue.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValue.java @@ -35,9 +35,8 @@ public class InternalSimpleValue extends InternalNumericMetricsAggregation.Singl public static final String NAME = "simple_value"; protected final double value; - InternalSimpleValue(String name, double value, DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalSimpleValue(String name, double value, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.format = formatter; this.value = value; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalStatsBucket.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalStatsBucket.java index 87fd22fa143..e776b13dcd6 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalStatsBucket.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/InternalStatsBucket.java @@ -30,8 +30,8 @@ import java.util.Map; public class InternalStatsBucket extends InternalStats implements StatsBucket { public InternalStatsBucket(String name, long count, double sum, double min, double max, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - super(name, count, sum, min, max, formatter, pipelineAggregators, metadata); + Map metadata) { + super(name, count, sum, min, max, formatter, metadata); } /** diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketPipelineAggregator.java index 3b1ffefd296..9f837124dd4 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MaxBucketPipelineAggregator.java @@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -69,9 +68,9 @@ public class MaxBucketPipelineAggregator extends BucketMetricsPipelineAggregator } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { + protected InternalAggregation buildAggregation(Map metadata) { String[] keys = maxBucketKeys.toArray(new String[maxBucketKeys.size()]); - return new InternalBucketMetricValue(name(), keys, maxValue, format, Collections.emptyList(), metadata()); + return new InternalBucketMetricValue(name(), keys, maxValue, format, metadata()); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MinBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MinBucketPipelineAggregator.java index 673a1177b93..0b234bdd740 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MinBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MinBucketPipelineAggregator.java @@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.Map; @@ -69,9 +68,9 @@ public class MinBucketPipelineAggregator extends BucketMetricsPipelineAggregator } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { + protected InternalAggregation buildAggregation(Map metadata) { String[] keys = minBucketKeys.toArray(new String[0]); - return new InternalBucketMetricValue(name(), keys, minValue, format, Collections.emptyList(), metadata()); + return new InternalBucketMetricValue(name(), keys, minValue, format, metadata()); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovAvgPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovAvgPipelineAggregator.java index 7865ebf7381..38794ae7042 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovAvgPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovAvgPipelineAggregator.java @@ -126,7 +126,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator { List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) .map((p) -> (InternalAggregation) p) .collect(Collectors.toList()); - aggs.add(new InternalSimpleValue(name(), movavg, formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), movavg, formatter, metadata())); newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); } @@ -156,7 +156,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator { aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) .map((p) -> (InternalAggregation) p) .collect(Collectors.toList()); - aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, metadata())); Bucket newBucket = factory.createBucket(newKey, bucket.getDocCount(), new InternalAggregations(aggs)); @@ -166,7 +166,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator { } else { // Not seen before, create fresh aggs = new ArrayList<>(); - aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, metadata())); Bucket newBucket = factory.createBucket(newKey, 0, new InternalAggregations(aggs)); diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovFnPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovFnPipelineAggregator.java index df572b9fe5f..00fef79daeb 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovFnPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/MovFnPipelineAggregator.java @@ -156,7 +156,7 @@ public class MovFnPipelineAggregator extends PipelineAggregator { .stream(bucket.getAggregations().spliterator(), false) .map(InternalAggregation.class::cast) .collect(Collectors.toList()); - aggs.add(new InternalSimpleValue(name(), movavg, formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), movavg, formatter, metadata())); newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); index++; } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketPipelineAggregator.java index e501197bf6f..380e06cff18 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/PercentilesBucketPipelineAggregator.java @@ -82,8 +82,7 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { - + protected InternalAggregation buildAggregation(Map metadata) { // Perform the sorting and percentile collection now that all the data // has been collected. Collections.sort(data); @@ -102,6 +101,6 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg // todo need postCollection() to clean up temp sorted data? - return new InternalPercentilesBucket(name(), percents, percentiles, keyed, format, pipelineAggregators, metadata); + return new InternalPercentilesBucket(name(), percents, percentiles, keyed, format, metadata); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffPipelineAggregator.java index 6d6f392d7ad..6e0c2d8aa99 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SerialDiffPipelineAggregator.java @@ -113,7 +113,7 @@ public class SerialDiffPipelineAggregator extends PipelineAggregator { List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map( (p) -> (InternalAggregation) p).collect(Collectors.toList()); - aggs.add(new InternalSimpleValue(name(), diff, formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleValue(name(), diff, formatter, metadata())); newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketPipelineAggregator.java index 104daa42dfe..345560e95de 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/StatsBucketPipelineAggregator.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; -import java.util.List; import java.util.Map; public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator { @@ -65,7 +64,7 @@ public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregat } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { - return new InternalStatsBucket(name(), count, sum, min, max, format, pipelineAggregators, metadata); + protected InternalAggregation buildAggregation(Map metadata) { + return new InternalStatsBucket(name(), count, sum, min, max, format, metadata); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SumBucketPipelineAggregator.java b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SumBucketPipelineAggregator.java index 4f7ff5fb851..4b4a75224c2 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SumBucketPipelineAggregator.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/pipeline/SumBucketPipelineAggregator.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import java.io.IOException; -import java.util.List; import java.util.Map; public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator { @@ -59,8 +58,8 @@ public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator } @Override - protected InternalAggregation buildAggregation(List pipelineAggregators, Map metadata) { - return new InternalSimpleValue(name(), sum, format, pipelineAggregators, metadata); + protected InternalAggregation buildAggregation(Map metadata) { + return new InternalSimpleValue(name(), sum, format, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/action/search/SearchPhaseControllerTests.java b/server/src/test/java/org/elasticsearch/action/search/SearchPhaseControllerTests.java index 42231a99567..886a408b435 100644 --- a/server/src/test/java/org/elasticsearch/action/search/SearchPhaseControllerTests.java +++ b/server/src/test/java/org/elasticsearch/action/search/SearchPhaseControllerTests.java @@ -78,6 +78,8 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import java.util.stream.Stream; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonList; import static org.elasticsearch.action.search.SearchProgressListener.NOOP; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -384,8 +386,7 @@ public class SearchPhaseControllerTests extends ESTestCase { new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE)); result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN), new DocValueFormat[0]); - InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW, - Collections.emptyList(), Collections.emptyMap()))); + InternalAggregations aggs = new InternalAggregations(singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW, emptyMap()))); result.aggregations(aggs); result.setShardIndex(0); consumer.consumeResult(result); @@ -394,8 +395,7 @@ public class SearchPhaseControllerTests extends ESTestCase { new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE)); result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN), new DocValueFormat[0]); - aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW, - Collections.emptyList(), Collections.emptyMap()))); + aggs = new InternalAggregations(singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW, emptyMap()))); result.aggregations(aggs); result.setShardIndex(2); consumer.consumeResult(result); @@ -404,8 +404,7 @@ public class SearchPhaseControllerTests extends ESTestCase { new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE)); result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN), new DocValueFormat[0]); - aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW, - Collections.emptyList(), Collections.emptyMap()))); + aggs = new InternalAggregations(singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW, emptyMap()))); result.aggregations(aggs); result.setShardIndex(1); consumer.consumeResult(result); @@ -475,7 +474,7 @@ public class SearchPhaseControllerTests extends ESTestCase { new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[] {new ScoreDoc(0, number)}), number), new DocValueFormat[0]); InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()))); + DocValueFormat.RAW, Collections.emptyMap()))); result.aggregations(aggs); result.setShardIndex(id); result.size(1); @@ -518,7 +517,7 @@ public class SearchPhaseControllerTests extends ESTestCase { result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), number), new DocValueFormat[0]); InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()))); + DocValueFormat.RAW, Collections.emptyMap()))); result.aggregations(aggs); result.setShardIndex(i); result.size(1); @@ -868,8 +867,8 @@ public class SearchPhaseControllerTests extends ESTestCase { result.topDocs(new TopDocsAndMaxScore( new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[]{new ScoreDoc(0, number)}), number), new DocValueFormat[0]); - InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()))); + InternalAggregations aggs = new InternalAggregations(Collections.singletonList( + new InternalMax("test", (double) number, DocValueFormat.RAW, Collections.emptyMap()))); result.aggregations(aggs); result.setShardIndex(id); result.size(1); diff --git a/server/src/test/java/org/elasticsearch/action/search/SearchResponseMergerTests.java b/server/src/test/java/org/elasticsearch/action/search/SearchResponseMergerTests.java index 5d5c56751d6..978a4c2a77a 100644 --- a/server/src/test/java/org/elasticsearch/action/search/SearchResponseMergerTests.java +++ b/server/src/test/java/org/elasticsearch/action/search/SearchResponseMergerTests.java @@ -63,6 +63,8 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; +import static java.util.Collections.emptyMap; +import static java.util.Collections.singletonList; import static org.elasticsearch.test.InternalAggregationTestCase.emptyReduceContextBuilder; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.greaterThan; @@ -361,14 +363,13 @@ public class SearchResponseMergerTests extends ESTestCase { for (int i = 0; i < numResponses; i++) { double value = randomDouble(); maxValue = Math.max(value, maxValue); - InternalMax max = new InternalMax(maxAggName, value, DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalMax max = new InternalMax(maxAggName, value, DocValueFormat.RAW, Collections.emptyMap()); InternalDateRange.Factory factory = new InternalDateRange.Factory(); int count = randomIntBetween(1, 1000); totalCount += count; InternalDateRange.Bucket bucket = factory.createBucket("bucket", 0, 10000, count, InternalAggregations.EMPTY, false, DocValueFormat.RAW); - InternalDateRange range = factory.create(rangeAggName, Collections.singletonList(bucket), DocValueFormat.RAW, false, - Collections.emptyList(), Collections.emptyMap()); + InternalDateRange range = factory.create(rangeAggName, singletonList(bucket), DocValueFormat.RAW, false, emptyMap()); InternalAggregations aggs = new InternalAggregations(Arrays.asList(range, max)); SearchHits searchHits = new SearchHits(new SearchHit[0], null, Float.NaN); InternalSearchResponse internalSearchResponse = new InternalSearchResponse(searchHits, aggs, null, null, false, null, 1); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationsTests.java index e53b31fe20e..0b3322cf48c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/InternalAggregationsTests.java @@ -62,7 +62,7 @@ public class InternalAggregationsTests extends ESTestCase { public void testNonFinalReduceTopLevelPipelineAggs() { InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), - 10, 1, Collections.emptyList(), Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0); + 10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0); List aggs = singletonList(new InternalAggregations(Collections.singletonList(terms))); InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(aggs, maxBucketReduceContext().forPartialReduction()); assertEquals(1, reducedAggs.getTopLevelPipelineAggregators().size()); @@ -71,7 +71,7 @@ public class InternalAggregationsTests extends ESTestCase { public void testFinalReduceTopLevelPipelineAggs() { InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), - 10, 1, Collections.emptyList(), Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0); + 10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0); InternalAggregations aggs = new InternalAggregations(Collections.singletonList(terms)); InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(Collections.singletonList(aggs), diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregationTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregationTests.java index 06d664efff5..47502f1eef0 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregationTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/InternalMultiBucketAggregationTests.java @@ -41,8 +41,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToAgg() { AggregationPath path = AggregationPath.parse("the_avg"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -55,8 +54,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToAggValue() { AggregationPath path = AggregationPath.parse("the_avg.value"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -69,8 +67,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToNothing() { AggregationPath path = AggregationPath.parse("foo.value"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -84,8 +81,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToUnknown() { AggregationPath path = AggregationPath.parse("the_avg.unknown"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -99,8 +95,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToBucketCount() { AggregationPath path = AggregationPath.parse("_bucket_count"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -113,8 +108,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToCount() { AggregationPath path = AggregationPath.parse("_count"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -127,8 +121,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { public void testResolveToKey() { AggregationPath path = AggregationPath.parse("_key"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -142,14 +135,13 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { AggregationPath path = AggregationPath.parse("string_terms['foo']>the_avg.value"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg)); List stringBuckets = Collections.singletonList(new StringTerms.Bucket( new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1, internalStringAggs, false, 0, DocValueFormat.RAW)); - InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyList(), + InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg)); LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); @@ -163,14 +155,13 @@ public class InternalMultiBucketAggregationTests extends ESTestCase { AggregationPath path = AggregationPath.parse("string_terms['bar']>the_avg.value"); List buckets = new ArrayList<>(); - InternalAggregation agg = new InternalAvg("the_avg", 2, 1, - DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()); + InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap()); InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg)); List stringBuckets = Collections.singletonList(new StringTerms.Bucket( new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1, internalStringAggs, false, 0, DocValueFormat.RAW)); - InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyList(), + InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg)); LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/adjacency/InternalAdjacencyMatrixTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/adjacency/InternalAdjacencyMatrixTests.java index 53defac10ca..10d236ec05f 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/adjacency/InternalAdjacencyMatrixTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/adjacency/InternalAdjacencyMatrixTests.java @@ -31,6 +31,8 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import static java.util.Collections.emptyList; + public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregationTestCase { private List keys; @@ -66,15 +68,14 @@ public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregation } @Override - protected InternalAdjacencyMatrix createTestInstance(String name, List pipelineAggregators, - Map metadata, InternalAggregations aggregations) { + protected InternalAdjacencyMatrix createTestInstance(String name, Map metadata, InternalAggregations aggregations) { final List buckets = new ArrayList<>(); for (int i = 0; i < keys.size(); ++i) { String key = keys.get(i); int docCount = randomIntBetween(0, 1000); buckets.add(new InternalAdjacencyMatrix.InternalBucket(key, docCount, aggregations)); } - return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators, metadata); + return new InternalAdjacencyMatrix(name, buckets, emptyList(), metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/InternalCompositeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/InternalCompositeTests.java index 7abc2892b1b..534e3a13890 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/InternalCompositeTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/composite/InternalCompositeTests.java @@ -27,7 +27,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import org.junit.After; @@ -155,8 +154,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa } @Override - protected InternalComposite createTestInstance(String name, List pipelineAggregators, - Map metadata, InternalAggregations aggregations) { + protected InternalComposite createTestInstance(String name, Map metadata, InternalAggregations aggregations) { int numBuckets = randomIntBetween(0, size); List buckets = new ArrayList<>(); TreeSet keys = new TreeSet<>(getKeyComparator()); @@ -233,7 +231,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa } public void testReduceSame() throws IOException { - InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyList(), Collections.emptyMap(), + InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyMap(), InternalAggregations.EMPTY); List toReduce = new ArrayList<>(); int numSame = randomIntBetween(1, 10); @@ -254,7 +252,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa * Check that reducing with an unmapped index produces useful formats. */ public void testReduceUnmapped() throws IOException { - InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyList(), emptyMap(), InternalAggregations.EMPTY); + InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyMap(), InternalAggregations.EMPTY); List rawFormats = formats.stream().map(f -> DocValueFormat.RAW).collect(toList()); InternalComposite unmapped = new InternalComposite(mapped.getName(), mapped.getSize(), sourceNames, rawFormats, emptyList(), null, reverseMuls, true, emptyList(), emptyMap()); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFiltersTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFiltersTests.java index e977077c0c0..7a683674383 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFiltersTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/filter/InternalFiltersTests.java @@ -21,10 +21,9 @@ package org.elasticsearch.search.aggregations.bucket.filter; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; import org.elasticsearch.search.aggregations.bucket.filter.InternalFilters.InternalBucket; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; +import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import java.util.ArrayList; import java.util.HashMap; @@ -54,15 +53,14 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase } @Override - protected InternalFilters createTestInstance(String name, List pipelineAggregators, Map metadata, - InternalAggregations aggregations) { + protected InternalFilters createTestInstance(String name, Map metadata, InternalAggregations aggregations) { final List buckets = new ArrayList<>(); for (int i = 0; i < keys.size(); ++i) { String key = keys.get(i); int docCount = randomIntBetween(0, 1000); buckets.add(new InternalFilters.InternalBucket(key, docCount, aggregations, keyed)); } - return new InternalFilters(name, buckets, keyed, pipelineAggregators, metadata); + return new InternalFilters(name, buckets, keyed, metadata); } @Override @@ -96,7 +94,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase protected InternalFilters mutateInstance(InternalFilters instance) { String name = instance.getName(); List buckets = instance.getBuckets(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -116,6 +113,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase metadata.put(randomAlphaOfLength(15), randomInt()); break; } - return new InternalFilters(name, buckets, keyed, pipelineAggregators, metadata); + return new InternalFilters(name, buckets, keyed, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java index 394eb2fb8ed..2ddee15c662 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoGridTestCase.java @@ -20,9 +20,8 @@ package org.elasticsearch.search.aggregations.bucket.geogrid; import org.apache.lucene.index.IndexWriter; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; +import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import java.util.ArrayList; import java.util.HashMap; @@ -38,7 +37,7 @@ public abstract class GeoGridTestCase buckets, - List pipelineAggregators, Map metadata); + Map metadata); /** * Instantiate a {@link InternalGeoGridBucket}-derived class using the same parameters as constructor. @@ -66,10 +65,7 @@ public abstract class GeoGridTestCase pipelineAggregators, - Map metadata, - InternalAggregations aggregations) { + protected T createTestInstance(String name, Map metadata, InternalAggregations aggregations) { final int precision = randomPrecision(); int size = randomNumberOfBuckets(); List buckets = new ArrayList<>(size); @@ -80,7 +76,7 @@ public abstract class GeoGridTestCase buckets = instance.getBuckets(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -157,7 +152,7 @@ public abstract class GeoGridTestCase buckets, - List pipelineAggregators, Map metadata) { - return new InternalGeoHashGrid(name, size, buckets, pipelineAggregators, metadata); + Map metadata) { + return new InternalGeoHashGrid(name, size, buckets, metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridTests.java index 97c66c0c3ee..dbe56ec7b14 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/geogrid/GeoTileGridTests.java @@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.List; import java.util.Map; @@ -29,8 +28,8 @@ public class GeoTileGridTests extends GeoGridTestCase buckets, - List pipelineAggregators, Map metadata) { - return new InternalGeoTileGrid(name, size, buckets, pipelineAggregators, metadata); + Map metadata) { + return new InternalGeoTileGrid(name, size, buckets, metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalAutoDateHistogramTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalAutoDateHistogramTests.java index 1eed04efe11..15f6d792b6c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalAutoDateHistogramTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalAutoDateHistogramTests.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Map; import java.util.TreeMap; +import static java.util.Collections.emptyList; import static org.elasticsearch.common.unit.TimeValue.timeValueHours; import static org.elasticsearch.common.unit.TimeValue.timeValueMinutes; import static org.elasticsearch.common.unit.TimeValue.timeValueSeconds; @@ -59,7 +60,6 @@ public class InternalAutoDateHistogramTests extends InternalMultiBucketAggregati @Override protected InternalAutoDateHistogram createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations) { @@ -79,7 +79,7 @@ public class InternalAutoDateHistogramTests extends InternalMultiBucketAggregati } InternalAggregations subAggregations = new InternalAggregations(Collections.emptyList()); BucketInfo bucketInfo = new BucketInfo(roundingInfos, randomIntBetween(0, roundingInfos.length - 1), subAggregations); - return new InternalAutoDateHistogram(name, buckets, targetBuckets, bucketInfo, format, pipelineAggregators, metadata, 1); + return new InternalAutoDateHistogram(name, buckets, targetBuckets, bucketInfo, format, emptyList(), metadata, 1); } /* diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogramTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogramTests.java index 62e11c1e2f0..8dea35d37a1 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogramTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalDateHistogramTests.java @@ -26,7 +26,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import java.time.ZonedDateTime; @@ -80,7 +79,6 @@ public class InternalDateHistogramTests extends InternalMultiBucketAggregationTe @Override protected InternalDateHistogram createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations) { int nbBuckets = randomNumberOfBuckets(); @@ -95,8 +93,7 @@ public class InternalDateHistogramTests extends InternalMultiBucketAggregationTe } } BucketOrder order = BucketOrder.key(randomBoolean()); - return new InternalDateHistogram(name, buckets, order, minDocCount, 0L, emptyBucketInfo, format, keyed, - pipelineAggregators, metadata); + return new InternalDateHistogram(name, buckets, order, minDocCount, 0L, emptyBucketInfo, format, keyed, metadata); } @Override @@ -162,7 +159,6 @@ public class InternalDateHistogramTests extends InternalMultiBucketAggregationTe BucketOrder order = instance.getOrder(); long minDocCount = instance.getMinDocCount(); long offset = instance.getOffset(); - List pipelineAggregators = instance.pipelineAggregators(); InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = instance.emptyBucketInfo; Map metadata = instance.getMetadata(); switch (between(0, 5)) { @@ -195,7 +191,6 @@ public class InternalDateHistogramTests extends InternalMultiBucketAggregationTe default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, keyed, pipelineAggregators, - metadata); + return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, keyed, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java index c6cd25719af..fe79f701e3e 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/histogram/InternalHistogramTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; @@ -73,10 +72,7 @@ public class InternalHistogramTests extends InternalMultiBucketAggregationTestCa } @Override - protected InternalHistogram createTestInstance(String name, - List pipelineAggregators, - Map metadata, - InternalAggregations aggregations) { + protected InternalHistogram createTestInstance(String name, Map metadata, InternalAggregations aggregations) { final double base = round(randomInt(50) - 30); final int numBuckets = randomNumberOfBuckets(); List buckets = new ArrayList<>(); @@ -88,7 +84,7 @@ public class InternalHistogramTests extends InternalMultiBucketAggregationTestCa } } BucketOrder order = BucketOrder.key(randomBoolean()); - return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, pipelineAggregators, metadata); + return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, metadata); } // issue 26787 @@ -169,7 +165,6 @@ public class InternalHistogramTests extends InternalMultiBucketAggregationTestCa List buckets = instance.getBuckets(); BucketOrder order = instance.getOrder(); long minDocCount = instance.getMinDocCount(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); InternalHistogram.EmptyBucketInfo emptyBucketInfo = instance.emptyBucketInfo; switch (between(0, 4)) { @@ -199,6 +194,6 @@ public class InternalHistogramTests extends InternalMultiBucketAggregationTestCa default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, pipelineAggregators, metadata); + return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, format, keyed, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java index 768b574910d..a12515f7cbd 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalBinaryRangeTests.java @@ -34,6 +34,8 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; + public class InternalBinaryRangeTests extends InternalRangeTestCase { private List> ranges; @@ -72,7 +74,6 @@ public class InternalBinaryRangeTests extends InternalRangeTestCase pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean keyed) { @@ -85,7 +86,7 @@ public class InternalBinaryRangeTests extends InternalRangeTestCase pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean keyed) { @@ -89,7 +87,7 @@ public class InternalDateRangeTests extends InternalRangeTestCase buckets = instance.getBuckets(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -144,6 +141,6 @@ public class InternalDateRangeTests extends InternalRangeTestCase pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean keyed) { @@ -81,7 +79,7 @@ public class InternalGeoDistanceTests extends InternalRangeTestCase buckets = instance.getBuckets(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -130,6 +127,6 @@ public class InternalGeoDistanceTests extends InternalRangeTestCase pipelineAggregators, - Map metadata, - InternalAggregations aggregations) { - return createTestInstance(name, pipelineAggregators, metadata, aggregations, keyed); + protected T createTestInstance(String name, Map metadata, InternalAggregations aggregations) { + return createTestInstance(name, metadata, aggregations, keyed); } - protected abstract T createTestInstance(String name, - List pipelineAggregators, - Map metadata, - InternalAggregations aggregations, - boolean keyed); + protected abstract T createTestInstance(String name, Map metadata, InternalAggregations aggregations, boolean keyed); + @Override protected void assertReduced(T reduced, List inputs) { final Map expectedCounts = new TreeMap<>(); diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalRangeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalRangeTests.java index 770c0be8b08..358e7e820e9 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalRangeTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/range/InternalRangeTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.Collections; @@ -77,7 +76,6 @@ public class InternalRangeTests extends InternalRangeTestCase { @Override protected InternalRange createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean keyed) { @@ -89,7 +87,7 @@ public class InternalRangeTests extends InternalRangeTestCase { double to = range.v2(); buckets.add(new InternalRange.Bucket("range_" + i, from, to, docCount, aggregations, keyed, format)); } - return new InternalRange<>(name, buckets, format, keyed, pipelineAggregators, metadata); + return new InternalRange<>(name, buckets, format, keyed, metadata); } @Override @@ -118,7 +116,6 @@ public class InternalRangeTests extends InternalRangeTestCase { DocValueFormat format = instance.format; boolean keyed = instance.keyed; List buckets = instance.getBuckets(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -144,6 +141,6 @@ public class InternalRangeTests extends InternalRangeTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalRange<>(name, buckets, format, keyed, pipelineAggregators, metadata); + return new InternalRange<>(name, buckets, format, keyed, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTermsTestCase.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTermsTestCase.java index a94aa268016..a9d79428218 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTermsTestCase.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/InternalSignificantTermsTestCase.java @@ -20,14 +20,13 @@ package org.elasticsearch.search.aggregations.bucket.significant; import org.elasticsearch.search.aggregations.InternalAggregations; -import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.ChiSquare; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.GND; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.JLHScore; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.MutualInformation; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; +import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import java.util.Arrays; import java.util.HashMap; @@ -49,7 +48,6 @@ public abstract class InternalSignificantTermsTestCase extends InternalMultiBuck @Override protected final InternalSignificantTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations) { final int requiredSize = randomIntBetween(1, 5); @@ -71,12 +69,11 @@ public abstract class InternalSignificantTermsTestCase extends InternalMultiBuck subsetSize += subsetDf; supersetSize += supersetDf; } - return createTestInstance(name, pipelineAggregators, metadata, aggregations, requiredSize, numBuckets, subsetSize, subsetDfs, + return createTestInstance(name, metadata, aggregations, requiredSize, numBuckets, subsetSize, subsetDfs, supersetSize, supersetDfs, significanceHeuristic); } protected abstract InternalSignificantTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, int requiredSize, int numBuckets, @@ -86,10 +83,9 @@ public abstract class InternalSignificantTermsTestCase extends InternalMultiBuck @Override protected InternalSignificantTerms createUnmappedInstance(String name, - List pipelineAggregators, Map metadata) { - InternalSignificantTerms testInstance = createTestInstance(name, pipelineAggregators, metadata); - return new UnmappedSignificantTerms(name, testInstance.requiredSize, testInstance.minDocCount, pipelineAggregators, metadata); + InternalSignificantTerms testInstance = createTestInstance(name, metadata); + return new UnmappedSignificantTerms(name, testInstance.requiredSize, testInstance.minDocCount, metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java index 8746ab90c14..e77f0a6f48a 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificanceHeuristicTests.java @@ -130,13 +130,11 @@ public class SignificanceHeuristicTests extends ESTestCase { if (randomBoolean()) { SignificantLongTerms.Bucket bucket = new SignificantLongTerms.Bucket(1, 2, 3, 4, 123, InternalAggregations.EMPTY, DocValueFormat.RAW, randomDoubleBetween(0, 100, true)); - return new SignificantLongTerms("some_name", 1, 1, emptyList(), null, DocValueFormat.RAW, 10, 20, heuristic, - singletonList(bucket)); + return new SignificantLongTerms("some_name", 1, 1, null, DocValueFormat.RAW, 10, 20, heuristic, singletonList(bucket)); } else { SignificantStringTerms.Bucket bucket = new SignificantStringTerms.Bucket(new BytesRef("someterm"), 1, 2, 3, 4, InternalAggregations.EMPTY, DocValueFormat.RAW, randomDoubleBetween(0, 100, true)); - return new SignificantStringTerms("some_name", 1, 1, emptyList(), null, DocValueFormat.RAW, 10, 20, heuristic, - singletonList(bucket)); + return new SignificantStringTerms("some_name", 1, 1, null, DocValueFormat.RAW, 10, 20, heuristic, singletonList(bucket)); } } @@ -192,7 +190,7 @@ public class SignificanceHeuristicTests extends ESTestCase { @Override SignificantStringTerms createAggregation(SignificanceHeuristic significanceHeuristic, long subsetSize, long supersetSize, List buckets) { - return new SignificantStringTerms("sig_terms", 2, -1, emptyList(), + return new SignificantStringTerms("sig_terms", 2, -1, emptyMap(), DocValueFormat.RAW, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -206,7 +204,7 @@ public class SignificanceHeuristicTests extends ESTestCase { @Override SignificantLongTerms createAggregation(SignificanceHeuristic significanceHeuristic, long subsetSize, long supersetSize, List buckets) { - return new SignificantLongTerms("sig_terms", 2, -1, new ArrayList(), emptyMap(), DocValueFormat.RAW, + return new SignificantLongTerms("sig_terms", 2, -1, emptyMap(), DocValueFormat.RAW, subsetSize, supersetSize, significanceHeuristic, buckets); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsTests.java index 2247a415047..2257f86a283 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantLongTermsTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.HashMap; @@ -45,7 +44,6 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase @Override protected InternalSignificantTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggs, int requiredSize, int numBuckets, @@ -62,7 +60,7 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase bucket.updateScore(significanceHeuristic); buckets.add(bucket); } - return new SignificantLongTerms(name, requiredSize, 1L, pipelineAggregators, metadata, format, subsetSize, + return new SignificantLongTerms(name, requiredSize, 1L, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -88,7 +86,6 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase long supersetSize = longTerms.getSupersetSize(); List buckets = longTerms.getBuckets(); SignificanceHeuristic significanceHeuristic = longTerms.significanceHeuristic; - List pipelineAggregators = longTerms.pipelineAggregators(); Map metadata = longTerms.getMetadata(); switch (between(0, 5)) { case 0: @@ -122,13 +119,12 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase default: throw new AssertionError("Illegal randomisation branch"); } - return new SignificantLongTerms(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, + return new SignificantLongTerms(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } else { String name = instance.getName(); int requiredSize = instance.requiredSize; long minDocCount = instance.minDocCount; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -151,7 +147,7 @@ public class SignificantLongTermsTests extends InternalSignificantTermsTestCase default: throw new AssertionError("Illegal randomisation branch"); } - return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators, metadata); + return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata); } } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsTests.java index 6cc689232f7..ca1e5927fee 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/significant/SignificantStringTermsTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.HashMap; @@ -38,7 +37,6 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas @Override protected InternalSignificantTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggs, int requiredSize, int numBuckets, @@ -55,7 +53,7 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas bucket.updateScore(significanceHeuristic); buckets.add(bucket); } - return new SignificantStringTerms(name, requiredSize, 1L, pipelineAggregators, metadata, format, subsetSize, + return new SignificantStringTerms(name, requiredSize, 1L, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } @@ -81,7 +79,6 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas long supersetSize = stringTerms.getSupersetSize(); List buckets = stringTerms.getBuckets(); SignificanceHeuristic significanceHeuristic = stringTerms.significanceHeuristic; - List pipelineAggregators = stringTerms.pipelineAggregators(); Map metadata = stringTerms.getMetadata(); switch (between(0, 5)) { case 0: @@ -116,13 +113,12 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas default: throw new AssertionError("Illegal randomisation branch"); } - return new SignificantStringTerms(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, + return new SignificantStringTerms(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets); } else { String name = instance.getName(); int requiredSize = instance.requiredSize; long minDocCount = instance.minDocCount; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -145,7 +141,7 @@ public class SignificantStringTermsTests extends InternalSignificantTermsTestCas default: throw new AssertionError("Illegal randomisation branch"); } - return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators, metadata); + return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata); } } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java index 2639220ed40..90cc3a7fd25 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/DoubleTermsTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +36,6 @@ public class DoubleTermsTests extends InternalTermsTestCase { @Override protected InternalTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean showTermDocCountError, @@ -56,7 +54,7 @@ public class DoubleTermsTests extends InternalTermsTestCase { int docCount = randomIntBetween(1, 100); buckets.add(new DoubleTerms.Bucket(term, docCount, aggregations, showTermDocCountError, docCountError, format)); } - return new DoubleTerms(name, order, requiredSize, minDocCount, pipelineAggregators, + return new DoubleTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -84,7 +82,6 @@ public class DoubleTermsTests extends InternalTermsTestCase { long otherDocCount = doubleTerms.getSumOfOtherDocCounts(); List buckets = doubleTerms.getBuckets(); long docCountError = doubleTerms.getDocCountError(); - List pipelineAggregators = doubleTerms.pipelineAggregators(); Map metadata = doubleTerms.getMetadata(); switch (between(0, 8)) { case 0: @@ -124,14 +121,13 @@ public class DoubleTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new DoubleTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, shardSize, + return new DoubleTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } else { String name = instance.getName(); BucketOrder order = instance.order; int requiredSize = instance.requiredSize; long minDocCount = instance.minDocCount; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -154,7 +150,7 @@ public class DoubleTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); + return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTermsTestCase.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTermsTestCase.java index 11a29f390e9..11dbd522e8c 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTermsTestCase.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/InternalTermsTestCase.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.bucket.terms; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.junit.Before; import java.util.HashMap; @@ -44,28 +43,20 @@ public abstract class InternalTermsTestCase extends InternalMultiBucketAggregati } @Override - protected InternalTerms createTestInstance(String name, - List pipelineAggregators, - Map metadata, - InternalAggregations aggregations) { - return createTestInstance(name, pipelineAggregators, metadata, aggregations, showDocCount, docCountError); + protected InternalTerms createTestInstance(String name, Map metadata, InternalAggregations aggregations) { + return createTestInstance(name, metadata, aggregations, showDocCount, docCountError); } protected abstract InternalTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean showTermDocCountError, long docCountError); @Override - protected InternalTerms createUnmappedInstance( - String name, - List pipelineAggregators, - Map metadata) { - InternalTerms testInstance = createTestInstance(name, pipelineAggregators, metadata); - return new UnmappedTerms(name, testInstance.order, testInstance.requiredSize, testInstance.minDocCount, - pipelineAggregators, metadata); + protected InternalTerms createUnmappedInstance(String name, Map metadata) { + InternalTerms testInstance = createTestInstance(name, metadata); + return new UnmappedTerms(name, testInstance.order, testInstance.requiredSize, testInstance.minDocCount, metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java index 226c2a271f6..9584cc30f66 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/LongTermsTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.HashMap; @@ -37,7 +36,6 @@ public class LongTermsTests extends InternalTermsTestCase { @Override protected InternalTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean showTermDocCountError, @@ -56,7 +54,7 @@ public class LongTermsTests extends InternalTermsTestCase { int docCount = randomIntBetween(1, 100); buckets.add(new LongTerms.Bucket(term, docCount, aggregations, showTermDocCountError, docCountError, format)); } - return new LongTerms(name, order, requiredSize, minDocCount, pipelineAggregators, + return new LongTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -84,7 +82,6 @@ public class LongTermsTests extends InternalTermsTestCase { long otherDocCount = longTerms.getSumOfOtherDocCounts(); List buckets = longTerms.getBuckets(); long docCountError = longTerms.getDocCountError(); - List pipelineAggregators = longTerms.pipelineAggregators(); Map metadata = longTerms.getMetadata(); switch (between(0, 8)) { case 0: @@ -124,14 +121,13 @@ public class LongTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new LongTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, shardSize, + return new LongTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } else { String name = instance.getName(); BucketOrder order = instance.order; int requiredSize = instance.requiredSize; long minDocCount = instance.minDocCount; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -154,7 +150,7 @@ public class LongTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); + return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata); } } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java index 1e882925a07..0d5cf75d630 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/bucket/terms/StringTermsTests.java @@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.ArrayList; import java.util.HashMap; @@ -38,7 +37,6 @@ public class StringTermsTests extends InternalTermsTestCase { @Override protected InternalTerms createTestInstance(String name, - List pipelineAggregators, Map metadata, InternalAggregations aggregations, boolean showTermDocCountError, @@ -57,7 +55,7 @@ public class StringTermsTests extends InternalTermsTestCase { int docCount = randomIntBetween(1, 100); buckets.add(new StringTerms.Bucket(term, docCount, aggregations, showTermDocCountError, docCountError, format)); } - return new StringTerms(name, order, requiredSize, minDocCount, pipelineAggregators, + return new StringTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } @@ -85,7 +83,6 @@ public class StringTermsTests extends InternalTermsTestCase { long otherDocCount = stringTerms.getSumOfOtherDocCounts(); List buckets = stringTerms.getBuckets(); long docCountError = stringTerms.getDocCountError(); - List pipelineAggregators = stringTerms.pipelineAggregators(); Map metadata = stringTerms.getMetadata(); switch (between(0, 8)) { case 0: @@ -125,14 +122,13 @@ public class StringTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new StringTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, shardSize, + return new StringTerms(name, order, requiredSize, minDocCount, metadata, format, shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); } else { String name = instance.getName(); BucketOrder order = instance.order; int requiredSize = instance.requiredSize; long minDocCount = instance.minDocCount; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -155,7 +151,7 @@ public class StringTermsTests extends InternalTermsTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); + return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata); } } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AbstractPercentilesTestCase.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AbstractPercentilesTestCase.java index 73a38febe39..3fc53826323 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AbstractPercentilesTestCase.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/AbstractPercentilesTestCase.java @@ -26,9 +26,6 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.Aggregation.CommonFields; import org.elasticsearch.search.aggregations.InternalAggregation; -import org.elasticsearch.search.aggregations.metrics.ParsedPercentiles; -import org.elasticsearch.search.aggregations.metrics.Percentile; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import java.io.IOException; @@ -57,16 +54,16 @@ public abstract class AbstractPercentilesTestCase pipelineAggregators, Map metadata) { + protected T createTestInstance(String name, Map metadata) { int numValues = frequently() ? randomInt(100) : 0; double[] values = new double[numValues]; for (int i = 0; i < numValues; ++i) { values[i] = randomDouble(); } - return createTestInstance(name, pipelineAggregators, metadata, keyed, docValueFormat, percents, values); + return createTestInstance(name, metadata, keyed, docValueFormat, percents, values); } - protected abstract T createTestInstance(String name, List pipelineAggregators, Map metadata, + protected abstract T createTestInstance(String name, Map metadata, boolean keyed, DocValueFormat format, double[] percents, double[] values); protected abstract Class implementationClass(); @@ -106,7 +103,7 @@ public abstract class AbstractPercentilesTestCase { @Override - protected InternalAvg createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected InternalAvg createTestInstance(String name, Map metadata) { DocValueFormat formatter = randomNumericDocValueFormat(); long count = frequently() ? randomNonNegativeLong() % 100000 : 0; - return new InternalAvg(name, randomDoubleBetween(0, 100000, true), count, formatter, pipelineAggregators, metadata); + return new InternalAvg(name, randomDoubleBetween(0, 100000, true), count, formatter, metadata); } @Override @@ -90,9 +89,9 @@ public class InternalAvgTests extends InternalAggregationTestCase { private void verifyAvgOfDoubles(double[] values, double expected, double delta) { List aggregations = new ArrayList<>(values.length); for (double value : values) { - aggregations.add(new InternalAvg("dummy1", value, 1, null, null, null)); + aggregations.add(new InternalAvg("dummy1", value, 1, null, null)); } - InternalAvg internalAvg = new InternalAvg("dummy2", 0, 0, null, null, null); + InternalAvg internalAvg = new InternalAvg("dummy2", 0, 0, null, null); InternalAvg reduced = internalAvg.reduce(aggregations, null); assertEquals(expected, reduced.getValue(), delta); } @@ -113,7 +112,6 @@ public class InternalAvgTests extends InternalAggregationTestCase { double sum = instance.getSum(); long count = instance.getCount(); DocValueFormat formatter = instance.getFormatter(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -144,6 +142,6 @@ public class InternalAvgTests extends InternalAggregationTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalAvg(name, sum, count, formatter, pipelineAggregators, metadata); + return new InternalAvg(name, sum, count, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalCardinalityTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalCardinalityTests.java index d6fad5e1cb5..71b6edb9de3 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalCardinalityTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalCardinalityTests.java @@ -28,10 +28,6 @@ import org.elasticsearch.common.util.MockBigArrays; import org.elasticsearch.common.util.MockPageCacheRecycler; import org.elasticsearch.indices.breaker.NoneCircuitBreakerService; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.metrics.HyperLogLogPlusPlus; -import org.elasticsearch.search.aggregations.metrics.InternalCardinality; -import org.elasticsearch.search.aggregations.metrics.ParsedCardinality; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import org.junit.After; @@ -61,15 +57,14 @@ public class InternalCardinalityTests extends InternalAggregationTestCase pipelineAggregators, Map metadata) { + protected InternalCardinality createTestInstance(String name, Map metadata) { HyperLogLogPlusPlus hllpp = new HyperLogLogPlusPlus(p, new MockBigArrays(new MockPageCacheRecycler(Settings.EMPTY), new NoneCircuitBreakerService()), 1); algos.add(hllpp); for (int i = 0; i < 100; i++) { hllpp.collect(0, BitMixer.mix64(randomIntBetween(1, 100))); } - return new InternalCardinality(name, hllpp, pipelineAggregators, metadata); + return new InternalCardinality(name, hllpp, metadata); } @Override @@ -103,7 +98,6 @@ public class InternalCardinalityTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -131,6 +125,6 @@ public class InternalCardinalityTests extends InternalAggregationTestCase pipelineAggregators, - Map metadata) { + protected InternalExtendedStats createTestInstance(String name, Map metadata) { long count = frequently() ? randomIntBetween(1, Integer.MAX_VALUE) : 0; double min = randomDoubleBetween(-1000000, 1000000, true); double max = randomDoubleBetween(-1000000, 1000000, true); double sum = randomDoubleBetween(-1000000, 1000000, true); DocValueFormat format = randomNumericDocValueFormat(); - return createInstance(name, count, sum, min, max, randomDoubleBetween(0, 1000000, true), - sigma, format, pipelineAggregators, metadata); + return createInstance(name, count, sum, min, max, randomDoubleBetween(0, 1000000, true), sigma, format, metadata); } protected InternalExtendedStats createInstance(String name, long count, double sum, double min, double max, double sumOfSqrs, - double sigma, DocValueFormat formatter, List pipelineAggregators, Map metadata) { - return new InternalExtendedStats(name, count, sum, min, max, sumOfSqrs, sigma, formatter, pipelineAggregators, metadata); + double sigma, DocValueFormat formatter, Map metadata) { + return new InternalExtendedStats(name, count, sum, min, max, sumOfSqrs, sigma, formatter, metadata); + } @Override @@ -127,7 +125,6 @@ public class InternalExtendedStatsTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 7)) { case 0: @@ -186,7 +183,7 @@ public class InternalExtendedStatsTests extends InternalAggregationTestCase aggregations = new ArrayList<>(values.length); double sigma = randomDouble(); for (double sumOfSqrs : values) { - aggregations.add(new InternalExtendedStats("dummy1", 1, 0.0, 0.0, 0.0, sumOfSqrs, sigma, null, null, null)); + aggregations.add(new InternalExtendedStats("dummy1", 1, 0.0, 0.0, 0.0, sumOfSqrs, sigma, null, null)); } - InternalExtendedStats stats = new InternalExtendedStats("dummy", 1, 0.0, 0.0, 0.0, 0.0, sigma, null, null, null); + InternalExtendedStats stats = new InternalExtendedStats("dummy", 1, 0.0, 0.0, 0.0, 0.0, sigma, null, null); InternalExtendedStats reduced = stats.reduce(aggregations, null); assertEquals(expectedSumOfSqrs, reduced.getSumOfSquares(), delta); } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoBoundsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoBoundsTests.java index 6992db906a5..6f4033c8bb2 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoBoundsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoBoundsTests.java @@ -24,25 +24,24 @@ import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; import static org.hamcrest.Matchers.closeTo; public class InternalGeoBoundsTests extends InternalAggregationTestCase { static final double GEOHASH_TOLERANCE = 1E-5D; @Override - protected InternalGeoBounds createTestInstance(String name, List pipelineAggregators, - Map metadata) { + protected InternalGeoBounds createTestInstance(String name, Map metadata) { // we occasionally want to test top = Double.NEGATIVE_INFINITY since this triggers empty xContent object double top = frequently() ? randomDouble() : Double.NEGATIVE_INFINITY; InternalGeoBounds geo = new InternalGeoBounds(name, top, randomDouble(), randomDouble(), randomDouble(), randomDouble(), randomDouble(), randomBoolean(), - pipelineAggregators, Collections.emptyMap()); + emptyList(), metadata); return geo; } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoCentroidTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoCentroidTests.java index 7de54008944..2d6b10ad606 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoCentroidTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalGeoCentroidTests.java @@ -22,8 +22,6 @@ import org.apache.lucene.geo.GeoEncodingUtils; import org.elasticsearch.common.geo.GeoPoint; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.metrics.InternalGeoCentroid; -import org.elasticsearch.search.aggregations.metrics.ParsedGeoCentroid; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import org.elasticsearch.test.geo.RandomGeoGenerator; @@ -36,8 +34,7 @@ import java.util.Map; public class InternalGeoCentroidTests extends InternalAggregationTestCase { @Override - protected InternalGeoCentroid createTestInstance(String name, List pipelineAggregators, - Map metadata) { + protected InternalGeoCentroid createTestInstance(String name, Map metadata) { GeoPoint centroid = RandomGeoGenerator.randomPoint(random()); // Re-encode lat/longs to avoid rounding issue when testing InternalGeoCentroid#hashCode() and diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesRanksTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesRanksTests.java index 7f9308e5fe6..0cbe4dc16da 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesRanksTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesRanksTests.java @@ -22,11 +22,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.HdrHistogram.DoubleHistogram; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.metrics.InternalHDRPercentileRanks; -import org.elasticsearch.search.aggregations.metrics.ParsedHDRPercentileRanks; -import org.elasticsearch.search.aggregations.metrics.InternalPercentilesRanksTestCase; -import org.elasticsearch.search.aggregations.metrics.ParsedPercentiles; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.Arrays; import java.util.HashMap; @@ -37,13 +32,13 @@ import java.util.Map; public class InternalHDRPercentilesRanksTests extends InternalPercentilesRanksTestCase { @Override - protected InternalHDRPercentileRanks createTestInstance(String name, List aggregators, Map metadata, + protected InternalHDRPercentileRanks createTestInstance(String name, Map metadata, boolean keyed, DocValueFormat format, double[] percents, double[] values) { final DoubleHistogram state = new DoubleHistogram(3); Arrays.stream(values).forEach(state::recordValue); - return new InternalHDRPercentileRanks(name, percents, state, keyed, format, aggregators, metadata); + return new InternalHDRPercentileRanks(name, percents, state, keyed, format, metadata); } @Override @@ -73,7 +68,6 @@ public class InternalHDRPercentilesRanksTests extends InternalPercentilesRanksTe DoubleHistogram state = instance.state; boolean keyed = instance.keyed; DocValueFormat formatter = instance.formatter(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 4)) { case 0: @@ -104,6 +98,6 @@ public class InternalHDRPercentilesRanksTests extends InternalPercentilesRanksTe default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalHDRPercentileRanks(name, percents, state, keyed, formatter, pipelineAggregators, metadata); + return new InternalHDRPercentileRanks(name, percents, state, keyed, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesTests.java index e50dbe9260c..9e42f60ed77 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalHDRPercentilesTests.java @@ -22,12 +22,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.HdrHistogram.DoubleHistogram; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.metrics.InternalHDRPercentiles; -import org.elasticsearch.search.aggregations.metrics.ParsedHDRPercentiles; -import org.elasticsearch.search.aggregations.metrics.InternalPercentilesTestCase; -import org.elasticsearch.search.aggregations.metrics.ParsedPercentiles; -import org.elasticsearch.search.aggregations.metrics.Percentile; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.Arrays; import java.util.HashMap; @@ -35,21 +29,19 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import static java.util.Collections.emptyList; import static java.util.Collections.emptyMap; public class InternalHDRPercentilesTests extends InternalPercentilesTestCase { @Override protected InternalHDRPercentiles createTestInstance(String name, - List pipelineAggregators, - Map metadata, + Map metadata, boolean keyed, DocValueFormat format, double[] percents, double[] values) { final DoubleHistogram state = new DoubleHistogram(3); Arrays.stream(values).forEach(state::recordValue); - return new InternalHDRPercentiles(name, percents, state, keyed, format, pipelineAggregators, metadata); + return new InternalHDRPercentiles(name, percents, state, keyed, format, metadata); } @Override @@ -80,7 +72,7 @@ public class InternalHDRPercentilesTests extends InternalPercentilesTestCase iterator = aggregation.iterator(); for (double percent : percents) { @@ -99,7 +91,6 @@ public class InternalHDRPercentilesTests extends InternalPercentilesTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 4)) { case 0: @@ -130,6 +121,6 @@ public class InternalHDRPercentilesTests extends InternalPercentilesTestCase { @Override - protected InternalMax createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected InternalMax createTestInstance(String name, Map metadata) { double value = frequently() ? randomDouble() : randomFrom(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); DocValueFormat formatter = randomNumericDocValueFormat(); - return new InternalMax(name, value, formatter, pipelineAggregators, metadata); + return new InternalMax(name, value, formatter, metadata); } @Override @@ -66,7 +65,6 @@ public class InternalMaxTests extends InternalAggregationTestCase { String name = instance.getName(); double value = instance.getValue(); DocValueFormat formatter = instance.format; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -90,6 +88,6 @@ public class InternalMaxTests extends InternalAggregationTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalMax(name, value, formatter, pipelineAggregators, metadata); + return new InternalMax(name, value, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviationTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviationTests.java index 4396c8c156e..60c26fa4dd6 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviationTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMedianAbsoluteDeviationTests.java @@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import java.io.IOException; @@ -32,10 +31,7 @@ import java.util.Map; public class InternalMedianAbsoluteDeviationTests extends InternalAggregationTestCase { @Override - protected InternalMedianAbsoluteDeviation createTestInstance(String name, - List pipelineAggregators, - Map metadata) { - + protected InternalMedianAbsoluteDeviation createTestInstance(String name, Map metadata) { final TDigestState valuesSketch = new TDigestState(randomDoubleBetween(20, 1000, true)); final int numberOfValues = frequently() ? randomIntBetween(0, 1000) @@ -44,7 +40,7 @@ public class InternalMedianAbsoluteDeviationTests extends InternalAggregationTes valuesSketch.add(randomDouble()); } - return new InternalMedianAbsoluteDeviation(name, pipelineAggregators, metadata, randomNumericDocValueFormat(), valuesSketch); + return new InternalMedianAbsoluteDeviation(name, metadata, randomNumericDocValueFormat(), valuesSketch); } @Override @@ -105,6 +101,6 @@ public class InternalMedianAbsoluteDeviationTests extends InternalAggregationTes break; } - return new InternalMedianAbsoluteDeviation(name, instance.pipelineAggregators(), metadata, instance.format, valuesSketch); + return new InternalMedianAbsoluteDeviation(name, metadata, instance.format, valuesSketch); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMinTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMinTests.java index f3e8229ebe2..31eb9bedcb3 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMinTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalMinTests.java @@ -22,7 +22,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import java.util.HashMap; @@ -31,10 +30,10 @@ import java.util.Map; public class InternalMinTests extends InternalAggregationTestCase { @Override - protected InternalMin createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected InternalMin createTestInstance(String name, Map metadata) { double value = frequently() ? randomDouble() : randomFrom(new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY }); DocValueFormat formatter = randomNumericDocValueFormat(); - return new InternalMin(name, value, formatter, pipelineAggregators, metadata); + return new InternalMin(name, value, formatter, metadata); } @Override @@ -65,7 +64,6 @@ public class InternalMinTests extends InternalAggregationTestCase { String name = instance.getName(); double value = instance.getValue(); DocValueFormat formatter = instance.format; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -89,6 +87,6 @@ public class InternalMinTests extends InternalAggregationTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalMin(name, value, formatter, pipelineAggregators, metadata); + return new InternalMin(name, value, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalScriptedMetricTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalScriptedMetricTests.java index 9926d32c566..176ed21fd27 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalScriptedMetricTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalScriptedMetricTests.java @@ -43,6 +43,8 @@ import java.util.Map; import java.util.function.Predicate; import java.util.function.Supplier; +import static java.util.Collections.emptyList; + public class InternalScriptedMetricTests extends InternalAggregationTestCase { private static final String REDUCE_SCRIPT_NAME = "reduceScript"; @@ -72,8 +74,7 @@ public class InternalScriptedMetricTests extends InternalAggregationTestCase pipelineAggregators, - Map metadata) { + protected InternalScriptedMetric createTestInstance(String name, Map metadata) { Map params = new HashMap<>(); if (randomBoolean()) { params.put(randomAlphaOfLength(5), randomAlphaOfLength(5)); @@ -83,7 +84,7 @@ public class InternalScriptedMetricTests extends InternalAggregationTestCase pipelineAggregators, Map metadata) { - return new InternalStatsBucket(name, count, sum, min, max, formatter, pipelineAggregators, metadata); + DocValueFormat formatter, Map metadata) { + return new InternalStatsBucket(name, count, sum, min, max, formatter, metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java index 79a915498e8..4548304f2e9 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalStatsTests.java @@ -26,12 +26,10 @@ import org.elasticsearch.common.xcontent.json.JsonXContent; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import java.io.IOException; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -39,18 +37,18 @@ import java.util.Map; public class InternalStatsTests extends InternalAggregationTestCase { @Override - protected InternalStats createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected InternalStats createTestInstance(String name, Map metadata) { long count = frequently() ? randomIntBetween(1, Integer.MAX_VALUE) : 0; double min = randomDoubleBetween(-1000000, 1000000, true); double max = randomDoubleBetween(-1000000, 1000000, true); double sum = randomDoubleBetween(-1000000, 1000000, true); DocValueFormat format = randomNumericDocValueFormat(); - return createInstance(name, count, sum, min, max, format, pipelineAggregators, metadata); + return createInstance(name, count, sum, min, max, format, metadata); } protected InternalStats createInstance(String name, long count, double sum, double min, double max, DocValueFormat formatter, - List pipelineAggregators, Map metadata) { - return new InternalStats(name, count, sum, min, max, formatter, pipelineAggregators, metadata); + Map metadata) { + return new InternalStats(name, count, sum, min, max, formatter, metadata); } @Override @@ -111,9 +109,9 @@ public class InternalStatsTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 5)) { case 0: @@ -205,7 +202,7 @@ public class InternalStatsTests extends InternalAggregationTestCase { @Override - protected InternalSum createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected InternalSum createTestInstance(String name, Map metadata) { double value = frequently() ? randomDouble() : randomFrom(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN); DocValueFormat formatter = randomFrom(new DocValueFormat.Decimal("###.##"), DocValueFormat.RAW); - return new InternalSum(name, value, formatter, pipelineAggregators, metadata); + return new InternalSum(name, value, formatter, metadata); } @Override @@ -84,9 +83,9 @@ public class InternalSumTests extends InternalAggregationTestCase { private void verifySummationOfDoubles(double[] values, double expected, double delta) { List aggregations = new ArrayList<>(values.length); for (double value : values) { - aggregations.add(new InternalSum("dummy1", value, null, null, null)); + aggregations.add(new InternalSum("dummy1", value, null, null)); } - InternalSum internalSum = new InternalSum("dummy", 0, null, null, null); + InternalSum internalSum = new InternalSum("dummy", 0, null, null); InternalSum reduced = internalSum.reduce(aggregations, null); assertEquals(expected, reduced.value(), delta); } @@ -103,7 +102,6 @@ public class InternalSumTests extends InternalAggregationTestCase { String name = instance.getName(); double value = instance.getValue(); DocValueFormat formatter = instance.format; - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -127,6 +125,6 @@ public class InternalSumTests extends InternalAggregationTestCase { default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalSum(name, value, formatter, pipelineAggregators, metadata); + return new InternalSum(name, value, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesRanksTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesRanksTests.java index 31a525264c7..e9066ae4334 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesRanksTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesRanksTests.java @@ -21,11 +21,6 @@ package org.elasticsearch.search.aggregations.metrics; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.DocValueFormat; -import org.elasticsearch.search.aggregations.metrics.InternalTDigestPercentileRanks; -import org.elasticsearch.search.aggregations.metrics.ParsedTDigestPercentileRanks; -import org.elasticsearch.search.aggregations.metrics.TDigestState; -import org.elasticsearch.search.aggregations.metrics.InternalPercentilesRanksTestCase; -import org.elasticsearch.search.aggregations.metrics.ParsedPercentiles; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.util.Arrays; @@ -33,17 +28,18 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; + public class InternalTDigestPercentilesRanksTests extends InternalPercentilesRanksTestCase { @Override - protected InternalTDigestPercentileRanks createTestInstance(String name, List aggregators, - Map metadata, + protected InternalTDigestPercentileRanks createTestInstance(String name, Map metadata, boolean keyed, DocValueFormat format, double[] percents, double[] values) { final TDigestState state = new TDigestState(100); Arrays.stream(values).forEach(state::add); assertEquals(state.centroidCount(), values.length); - return new InternalTDigestPercentileRanks(name, percents, state, keyed, format, aggregators, metadata); + return new InternalTDigestPercentileRanks(name, percents, state, keyed, format, emptyList(), metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesTests.java index 3c15bac71b2..d5d84ed4570 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTDigestPercentilesTests.java @@ -33,18 +33,19 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import static java.util.Collections.emptyList; + public class InternalTDigestPercentilesTests extends InternalPercentilesTestCase { @Override protected InternalTDigestPercentiles createTestInstance(String name, - List pipelineAggregators, Map metadata, boolean keyed, DocValueFormat format, double[] percents, double[] values) { final TDigestState state = new TDigestState(100); Arrays.stream(values).forEach(state::add); assertEquals(state.centroidCount(), values.length); - return new InternalTDigestPercentiles(name, percents, state, keyed, format, pipelineAggregators, metadata); + return new InternalTDigestPercentiles(name, percents, state, keyed, format, emptyList(), metadata); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTopHitsTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTopHitsTests.java index 25e03dc0e37..814509f01fa 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTopHitsTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/metrics/InternalTopHitsTests.java @@ -60,6 +60,7 @@ import java.util.Set; import static java.lang.Math.max; import static java.lang.Math.min; +import static java.util.Collections.emptyList; import static java.util.Comparator.comparing; public class InternalTopHitsTests extends InternalAggregationTestCase { @@ -69,7 +70,7 @@ public class InternalTopHitsTests extends InternalAggregationTestCase pipelineAggregators, Map metadata) { + protected InternalTopHits createTestInstance(String name, Map metadata) { int from = 0; int requestedSize = between(1, 40); int actualSize = between(0, requestedSize); @@ -131,7 +132,7 @@ public class InternalTopHitsTests extends InternalAggregationTestCase { @Override - protected InternalValueCount createTestInstance(String name, List pipelineAggregators, - Map metadata) { - return new InternalValueCount(name, randomIntBetween(0, 100), pipelineAggregators, metadata); + protected InternalValueCount createTestInstance(String name, Map metadata) { + return new InternalValueCount(name, randomIntBetween(0, 100), metadata); } @Override @@ -58,7 +54,6 @@ public class InternalValueCountTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -82,6 +77,6 @@ public class InternalValueCountTests extends InternalAggregationTestCase { @Override - protected InternalWeightedAvg createTestInstance( - String name, - List pipelineAggregators, - Map metadata - ) { + protected InternalWeightedAvg createTestInstance(String name, Map metadata) { DocValueFormat formatter = randomNumericDocValueFormat(); return new InternalWeightedAvg( name, randomDoubleBetween(0, 100000, true), randomDoubleBetween(0, 100000, true), - formatter, pipelineAggregators, metadata); + formatter, metadata); } @Override @@ -78,7 +74,6 @@ public class InternalWeightedAvgTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -109,6 +104,6 @@ public class InternalWeightedAvgTests extends InternalAggregationTestCase { @Override - protected InternalBucketMetricValue createTestInstance(String name, List pipelineAggregators, - Map metadata) { + protected InternalBucketMetricValue createTestInstance(String name, Map metadata) { double value = frequently() ? randomDoubleBetween(-10000, 100000, true) : randomFrom(new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN }); String[] keys = new String[randomIntBetween(0, 5)]; for (int i = 0; i < keys.length; i++) { keys[i] = randomAlphaOfLength(10); } - return new InternalBucketMetricValue(name, keys, value, randomNumericDocValueFormat(), pipelineAggregators, metadata); + return new InternalBucketMetricValue(name, keys, value, randomNumericDocValueFormat(), metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, - null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override @@ -84,7 +77,6 @@ public class InternalBucketMetricValueTests extends InternalAggregationTestCase< String[] keys = instance.keys(); double value = instance.value(); DocValueFormat formatter = instance.formatter(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -112,6 +104,6 @@ public class InternalBucketMetricValueTests extends InternalAggregationTestCase< default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalBucketMetricValue(name, keys, value, formatter, pipelineAggregators, metadata); + return new InternalBucketMetricValue(name, keys, value, formatter, metadata); } } diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivativeTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivativeTests.java index 0ad8a51e4d0..208dfcbaed8 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivativeTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalDerivativeTests.java @@ -22,12 +22,8 @@ package org.elasticsearch.search.aggregations.pipeline; import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.InternalDerivative; -import org.elasticsearch.search.aggregations.pipeline.ParsedDerivative; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -35,19 +31,17 @@ import java.util.Map; public class InternalDerivativeTests extends InternalAggregationTestCase { @Override - protected InternalDerivative createTestInstance(String name, - List pipelineAggregators, Map metadata) { + protected InternalDerivative createTestInstance(String name, Map metadata) { DocValueFormat formatter = randomNumericDocValueFormat(); double value = frequently() ? randomDoubleBetween(-100000, 100000, true) : randomFrom(new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN }); double normalizationFactor = frequently() ? randomDoubleBetween(0, 100000, true) : 0; - return new InternalDerivative(name, value, normalizationFactor, formatter, pipelineAggregators, metadata); + return new InternalDerivative(name, value, normalizationFactor, formatter, metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override @@ -79,7 +73,6 @@ public class InternalDerivativeTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -106,6 +99,6 @@ public class InternalDerivativeTests extends InternalAggregationTestCase pipelineAggregators, Map metadata) { - return new InternalExtendedStatsBucket(name, count, sum, min, max, sumOfSqrs, sigma, formatter, pipelineAggregators, - Collections.emptyMap()); + return new InternalExtendedStatsBucket(name, count, sum, min, max, sumOfSqrs, sigma, formatter, metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucketTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucketTests.java index 503b639dff5..dff1c455e97 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucketTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalPercentilesBucketTests.java @@ -46,30 +46,28 @@ import static org.hamcrest.Matchers.equalTo; public class InternalPercentilesBucketTests extends InternalAggregationTestCase { @Override - protected InternalPercentilesBucket createTestInstance(String name, List pipelineAggregators, - Map metadata) { - return createTestInstance(name, pipelineAggregators, metadata, randomPercents(), true); + protected InternalPercentilesBucket createTestInstance(String name, Map metaData) { + return createTestInstance(name, metaData, randomPercents(), true); } - private static InternalPercentilesBucket createTestInstance(String name, List pipelineAggregators, - Map metadata, double[] percents, boolean keyed) { + private static InternalPercentilesBucket createTestInstance(String name, Map metaData, + double[] percents, boolean keyed) { final double[] percentiles = new double[percents.length]; for (int i = 0; i < percents.length; ++i) { percentiles[i] = frequently() ? randomDouble() : Double.NaN; } - return createTestInstance(name, pipelineAggregators, metadata, percents, percentiles, keyed); + return createTestInstance(name, metaData, percents, percentiles, keyed); } - private static InternalPercentilesBucket createTestInstance(String name, List pipelineAggregators, - Map metadata, double[] percents, double[] percentiles, boolean keyed) { + private static InternalPercentilesBucket createTestInstance(String name, Map metadata, + double[] percents, double[] percentiles, boolean keyed) { DocValueFormat format = randomNumericDocValueFormat(); - return new InternalPercentilesBucket(name, percents, percentiles, keyed, format, pipelineAggregators, metadata); + return new InternalPercentilesBucket(name, percents, percentiles, keyed, format, metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override @@ -103,8 +101,7 @@ public class InternalPercentilesBucketTests extends InternalAggregationTestCase< */ public void testPercentOrder() { final double[] percents = new double[]{ 0.50, 0.25, 0.01, 0.99, 0.60 }; - InternalPercentilesBucket aggregation = createTestInstance("test", Collections.emptyList(), - Collections.emptyMap(), percents, randomBoolean()); + InternalPercentilesBucket aggregation = createTestInstance("test", Collections.emptyMap(), percents, randomBoolean()); Iterator iterator = aggregation.iterator(); for (double percent : percents) { assertTrue(iterator.hasNext()); @@ -118,7 +115,7 @@ public class InternalPercentilesBucketTests extends InternalAggregationTestCase< final double[] percents = new double[]{ 0.1, 0.2, 0.3}; final double[] percentiles = new double[]{ 0.10, 0.2}; IllegalArgumentException e = expectThrows(IllegalArgumentException.class, () -> new InternalPercentilesBucket("test", percents, - percentiles, randomBoolean(), DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap())); + percentiles, randomBoolean(), DocValueFormat.RAW, Collections.emptyMap())); assertEquals("The number of provided percents and percentiles didn't match. percents: [0.1, 0.2, 0.3], percentiles: [0.1, 0.2]", e.getMessage()); } @@ -141,8 +138,7 @@ public class InternalPercentilesBucketTests extends InternalAggregationTestCase< } boolean keyed = randomBoolean(); - InternalPercentilesBucket agg = createTestInstance("test", Collections.emptyList(), Collections.emptyMap(), - percents, percentiles, keyed); + InternalPercentilesBucket agg = createTestInstance("test", Collections.emptyMap(), percents, percentiles, keyed); XContentBuilder builder = JsonXContent.contentBuilder().prettyPrint(); builder.startObject(); @@ -190,7 +186,6 @@ public class InternalPercentilesBucketTests extends InternalAggregationTestCase< double[] percents = extractPercents(instance); double[] percentiles = extractPercentiles(instance); DocValueFormat formatter = instance.formatter(); - List pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 3)) { case 0: @@ -215,7 +210,7 @@ public class InternalPercentilesBucketTests extends InternalAggregationTestCase< default: throw new AssertionError("Illegal randomisation branch"); } - return new InternalPercentilesBucket(name, percents, percentiles, randomBoolean(), formatter, pipelineAggregators, metadata); + return new InternalPercentilesBucket(name, percents, percentiles, randomBoolean(), formatter, metadata); } private double[] extractPercentiles(InternalPercentilesBucket instance) { diff --git a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValueTests.java b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValueTests.java index 21c3a8c5ef2..468351c91ba 100644 --- a/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValueTests.java +++ b/server/src/test/java/org/elasticsearch/search/aggregations/pipeline/InternalSimpleValueTests.java @@ -24,7 +24,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.test.InternalAggregationTestCase; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -32,18 +31,16 @@ import java.util.Map; public class InternalSimpleValueTests extends InternalAggregationTestCase{ @Override - protected InternalSimpleValue createTestInstance(String name, List pipelineAggregators, - Map metadata) { + protected InternalSimpleValue createTestInstance(String name, Map metadata) { DocValueFormat formatter = randomNumericDocValueFormat(); double value = frequently() ? randomDoubleBetween(0, 100000, true) : randomFrom(new Double[] { Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.NaN }); - return new InternalSimpleValue(name, value, formatter, pipelineAggregators, metadata); + return new InternalSimpleValue(name, value, formatter, metadata); } @Override public void testReduceRandom() { - expectThrows(UnsupportedOperationException.class, - () -> createTestInstance("name", Collections.emptyList(), null).reduce(null, null)); + expectThrows(UnsupportedOperationException.class, () -> createTestInstance("name", null).reduce(null, null)); } @Override @@ -74,7 +71,6 @@ public class InternalSimpleValueTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -98,7 +94,7 @@ public class InternalSimpleValueTests extends InternalAggregationTestCase { List aggs = new ArrayList<>(); if (hasInternalMax) { - aggs.add(new InternalMax("max", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); + aggs.add(new InternalMax("max", randomDouble(), randomNumericDocValueFormat(), emptyMap())); } if (hasInternalMin) { - aggs.add(new InternalMin("min", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); + aggs.add(new InternalMin("min", randomDouble(), randomNumericDocValueFormat(), emptyMap())); } return new InternalAggregations(aggs); }; @@ -73,10 +73,10 @@ public abstract class InternalSingleBucketAggregationTestCase inputs); @Override - protected final T createTestInstance(String name, List pipelineAggregators, Map metadata) { + protected final T createTestInstance(String name, Map metadata) { // we shouldn't use the full long range here since we sum doc count on reduce, and don't want to overflow the long range there long docCount = between(0, Integer.MAX_VALUE); - return createTestInstance(name, docCount, subAggregationsSupplier.get(), pipelineAggregators, metadata); + return createTestInstance(name, docCount, subAggregationsSupplier.get(), emptyList(), metadata); } @Override @@ -95,8 +95,8 @@ public abstract class InternalSingleBucketAggregationTestCase aggs = new ArrayList<>(); - aggs.add(new InternalMax("new_max", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); - aggs.add(new InternalMin("new_min", randomDouble(), randomNumericDocValueFormat(), emptyList(), emptyMap())); + aggs.add(new InternalMax("new_max", randomDouble(), randomNumericDocValueFormat(), emptyMap())); + aggs.add(new InternalMin("new_min", randomDouble(), randomNumericDocValueFormat(), emptyMap())); aggregations = new InternalAggregations(aggs); break; case 3: diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalAggregationTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/InternalAggregationTestCase.java index 98ff3f41a4f..5a00c7e863c 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalAggregationTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalAggregationTestCase.java @@ -273,14 +273,12 @@ public abstract class InternalAggregationTestCase return namedXContents; } - protected abstract T createTestInstance(String name, List pipelineAggregators, Map metadata); + protected abstract T createTestInstance(String name, Map metadata); /** Return an instance on an unmapped field. */ - protected T createUnmappedInstance(String name, - List pipelineAggregators, - Map metadata) { + protected T createUnmappedInstance(String name, Map metadata) { // For most impls, we use the same instance in the unmapped case and in the mapped case - return createTestInstance(name, pipelineAggregators, metadata); + return createTestInstance(name, metadata); } public void testReduceRandom() { @@ -341,8 +339,6 @@ public abstract class InternalAggregationTestCase } private T createTestInstance(String name) { - List pipelineAggregators = new ArrayList<>(); - // TODO populate pipelineAggregators Map metadata = null; if (randomBoolean()) { metadata = new HashMap<>(); @@ -351,19 +347,17 @@ public abstract class InternalAggregationTestCase metadata.put(randomAlphaOfLength(5), randomAlphaOfLength(5)); } } - return createTestInstance(name, pipelineAggregators, metadata); + return createTestInstance(name, metadata); } /** Return an instance on an unmapped field. */ protected final T createUnmappedInstance(String name) { - List pipelineAggregators = new ArrayList<>(); - // TODO populate pipelineAggregators Map metadata = new HashMap<>(); - int metadataCount = randomBoolean() ? 0 : between(1, 10); - while (metadata.size() < metadataCount) { + int metaDataCount = randomBoolean() ? 0 : between(1, 10); + while (metadata.size() < metaDataCount) { metadata.put(randomAlphaOfLength(5), randomAlphaOfLength(5)); } - return createUnmappedInstance(name, pipelineAggregators, metadata); + return createUnmappedInstance(name, metadata); } @Override diff --git a/test/framework/src/main/java/org/elasticsearch/test/InternalMultiBucketAggregationTestCase.java b/test/framework/src/main/java/org/elasticsearch/test/InternalMultiBucketAggregationTestCase.java index 547478d4a24..c8d1fbee2f0 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/InternalMultiBucketAggregationTestCase.java +++ b/test/framework/src/main/java/org/elasticsearch/test/InternalMultiBucketAggregationTestCase.java @@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.ArrayList; @@ -36,7 +35,6 @@ import java.util.List; import java.util.Map; import java.util.function.Supplier; -import static java.util.Collections.emptyList; import static java.util.Collections.emptyMap; public abstract class InternalMultiBucketAggregationTestCase @@ -77,7 +75,7 @@ public abstract class InternalMultiBucketAggregationTestCase aggs = new ArrayList<>(); for (int i = 0; i < numAggregations; i++) { - aggs.add(createTestInstance(randomAlphaOfLength(5), emptyList(), emptyMap(), InternalAggregations.EMPTY)); + aggs.add(createTestInstance(randomAlphaOfLength(5), emptyMap(), InternalAggregations.EMPTY)); } return new InternalAggregations(aggs); }; @@ -85,15 +83,14 @@ public abstract class InternalMultiBucketAggregationTestCase pipelineAggregators, Map metadata) { - T instance = createTestInstance(name, pipelineAggregators, metadata, subAggregationsSupplier.get()); + protected final T createTestInstance(String name, Map metadata) { + T instance = createTestInstance(name, metadata, subAggregationsSupplier.get()); assert instance.getBuckets().size() <= maxNumberOfBuckets() : "Maximum number of buckets exceeded for " + instance.getClass().getSimpleName() + " aggregation"; return instance; } - protected abstract T createTestInstance(String name, List pipelineAggregators, - Map metadata, InternalAggregations aggregations); + protected abstract T createTestInstance(String name, Map metadata, InternalAggregations aggregations); protected abstract Class implementationClass(); diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/BoxplotAggregator.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/BoxplotAggregator.java index e4e0456b344..f917ad87507 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/BoxplotAggregator.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/BoxplotAggregator.java @@ -130,7 +130,7 @@ public class BoxplotAggregator extends NumericMetricsAggregator.MultiValue { if (state == null) { return buildEmptyAggregation(); } else { - return new InternalBoxplot(name, state, format, pipelineAggregators(), metadata()); + return new InternalBoxplot(name, state, format, metadata()); } } @@ -143,7 +143,7 @@ public class BoxplotAggregator extends NumericMetricsAggregator.MultiValue { @Override public InternalAggregation buildEmptyAggregation() { - return new InternalBoxplot(name, new TDigestState(compression), format, pipelineAggregators(), metadata()); + return new InternalBoxplot(name, new TDigestState(compression), format, metadata()); } @Override diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplot.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplot.java index 51086ace47e..0280bbe66d6 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplot.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplot.java @@ -13,7 +13,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation; import org.elasticsearch.search.aggregations.metrics.TDigestState; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import java.io.IOException; import java.util.List; @@ -72,9 +71,8 @@ public class InternalBoxplot extends InternalNumericMetricsAggregation.MultiValu private final TDigestState state; - InternalBoxplot(String name, TDigestState state, DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + InternalBoxplot(String name, TDigestState state, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.state = state; this.format = formatter; } @@ -174,7 +172,7 @@ public class InternalBoxplot extends InternalNumericMetricsAggregation.MultiValu } merged.add(percentiles.state); } - return new InternalBoxplot(name, merged, format, pipelineAggregators(), metadata); + return new InternalBoxplot(name, merged, format, metadata); } @Override diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityPipelineAggregator.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityPipelineAggregator.java index 230a183df5c..7e8ad20b0f1 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityPipelineAggregator.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/CumulativeCardinalityPipelineAggregator.java @@ -82,7 +82,7 @@ public class CumulativeCardinalityPipelineAggregator extends PipelineAggregator List aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) .map((p) -> (InternalAggregation) p) .collect(Collectors.toList()); - aggs.add(new InternalSimpleLongValue(name(), cardinality, formatter, new ArrayList<>(), metadata())); + aggs.add(new InternalSimpleLongValue(name(), cardinality, formatter, metadata())); Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); newBuckets.add(newBucket); } diff --git a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/InternalSimpleLongValue.java b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/InternalSimpleLongValue.java index 72ba4fdd121..3a438ac746f 100644 --- a/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/InternalSimpleLongValue.java +++ b/x-pack/plugin/analytics/src/main/java/org/elasticsearch/xpack/analytics/cumulativecardinality/InternalSimpleLongValue.java @@ -11,7 +11,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.metrics.InternalNumericMetricsAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.pipeline.SimpleValue; import java.io.IOException; @@ -23,9 +22,8 @@ public class InternalSimpleLongValue extends InternalNumericMetricsAggregation.S public static final String NAME = "simple_long_value"; protected final long value; - public InternalSimpleLongValue(String name, long value, DocValueFormat formatter, List pipelineAggregators, - Map metadata) { - super(name, pipelineAggregators, metadata); + public InternalSimpleLongValue(String name, long value, DocValueFormat formatter, Map metadata) { + super(name, metadata); this.format = formatter; this.value = value; } diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplotTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplotTests.java index af72e11b762..dddcc53c263 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplotTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/boxplot/InternalBoxplotTests.java @@ -16,7 +16,6 @@ import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.metrics.TDigestState; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.test.InternalAggregationTestCase; import java.io.IOException; @@ -27,17 +26,15 @@ import java.util.Map; public class InternalBoxplotTests extends InternalAggregationTestCase { @Override - protected InternalBoxplot createTestInstance(String name, List pipelineAggregators, - Map metadata) { + protected InternalBoxplot createTestInstance(String name, Map metadata) { int numValues = frequently() ? randomInt(100) : 0; - double[] values = new double[numValues]; TDigestState state = new TDigestState(100); for (int i = 0; i < numValues; ++i) { state.add(randomDouble()); } DocValueFormat formatter = randomNumericDocValueFormat(); - return new InternalBoxplot(name, state, formatter, pipelineAggregators, metadata); + return new InternalBoxplot(name, state, formatter, metadata); } @Override @@ -74,7 +71,6 @@ public class InternalBoxplotTests extends InternalAggregationTestCase pipelineAggregators = instance.pipelineAggregators(); Map metadata = instance.getMetadata(); switch (between(0, 2)) { case 0: @@ -94,7 +90,7 @@ public class InternalBoxplotTests extends InternalAggregationTestCase pipelineAggregators, Map metadata) { + @Override + protected InternalStringStats createTestInstance(String name, Map metadata) { if (randomBoolean()) { - return new InternalStringStats(name, 0, 0, 0, 0, emptyMap(), randomBoolean(), DocValueFormat.RAW, - pipelineAggregators, metadata); + return new InternalStringStats(name, 0, 0, 0, 0, emptyMap(), randomBoolean(), DocValueFormat.RAW, emptyList(), metadata); } return new InternalStringStats(name, randomLongBetween(1, Long.MAX_VALUE), randomNonNegativeLong(), between(0, Integer.MAX_VALUE), between(0, Integer.MAX_VALUE), randomCharOccurrences(), randomBoolean(), DocValueFormat.RAW, - pipelineAggregators, metadata); + emptyList(), metadata); }; @Override diff --git a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java index 71c16388b24..d961d15d0d8 100644 --- a/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java +++ b/x-pack/plugin/analytics/src/test/java/org/elasticsearch/xpack/analytics/topmetrics/InternalTopMetricsTests.java @@ -16,7 +16,6 @@ import org.elasticsearch.index.mapper.DateFieldMapper; import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.ParsedAggregation; -import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortValue; import org.elasticsearch.test.InternalAggregationTestCase; @@ -217,18 +216,17 @@ public class InternalTopMetricsTests extends InternalAggregationTestCase pipelineAggregators, - Map metadata) { - return createTestInstance(name, pipelineAggregators, metadata, InternalAggregationTestCase::randomNumericDocValueFormat); + protected InternalTopMetrics createTestInstance(String name, Map metadata) { + return createTestInstance(name, metadata, InternalAggregationTestCase::randomNumericDocValueFormat); } - private InternalTopMetrics createTestInstance(String name, List pipelineAggregators, + private InternalTopMetrics createTestInstance(String name, Map metadata, Supplier randomDocValueFormat) { int metricCount = between(1, 5); List metricNames = randomMetricNames(metricCount); int size = between(1, 100); List topMetrics = randomTopMetrics(randomDocValueFormat, between(0, size), metricCount); - return new InternalTopMetrics(name, sortOrder, metricNames, size, topMetrics, pipelineAggregators, metadata); + return new InternalTopMetrics(name, sortOrder, metricNames, size, topMetrics, emptyList(), metadata); } @Override @@ -277,8 +275,7 @@ public class InternalTopMetricsTests extends InternalAggregationTestCase aggTreeWithoutFilter = new ArrayList<>(1); - InternalMax max = new InternalMax("filter_foo", 0, DocValueFormat.RAW, Collections.emptyList(), null); + InternalMax max = new InternalMax("filter_foo", 0, DocValueFormat.RAW, null); aggTreeWithoutFilter.add(max); Aggregations mockAggsWithout = new InternalAggregations(aggTreeWithoutFilter); when(responseWithout.getAggregations()).thenReturn(mockAggsWithout); @@ -357,7 +357,7 @@ public class RollupResponseTranslationTests extends AggregatorTestCase { SearchResponse protoResponse = mock(SearchResponse.class); when(protoResponse.getTook()).thenReturn(new TimeValue(100)); List protoAggTree = new ArrayList<>(1); - InternalAvg internalAvg = new InternalAvg("foo", 10, 2, DocValueFormat.RAW, Collections.emptyList(), null); + InternalAvg internalAvg = new InternalAvg("foo", 10, 2, DocValueFormat.RAW, null); protoAggTree.add(internalAvg); Aggregations protoMockAggs = new InternalAggregations(protoAggTree); when(protoResponse.getAggregations()).thenReturn(protoMockAggs); diff --git a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/SearchActionTests.java b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/SearchActionTests.java index f4fd7f7c482..0ad7d13d4fb 100644 --- a/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/SearchActionTests.java +++ b/x-pack/plugin/rollup/src/test/java/org/elasticsearch/xpack/rollup/action/SearchActionTests.java @@ -745,7 +745,7 @@ public class SearchActionTests extends ESTestCase { SearchResponse protoResponse = mock(SearchResponse.class); when(protoResponse.getTook()).thenReturn(new TimeValue(100)); List protoAggTree = new ArrayList<>(1); - InternalAvg internalAvg = new InternalAvg("foo", 10, 2, DocValueFormat.RAW, emptyList(), null); + InternalAvg internalAvg = new InternalAvg("foo", 10, 2, DocValueFormat.RAW, null); protoAggTree.add(internalAvg); Aggregations protoMockAggs = new InternalAggregations(protoAggTree); when(protoResponse.getAggregations()).thenReturn(protoMockAggs);