Begin to drop pipeline aggs from the result tree (backport of #54311) (#54659)

Removes pipeline aggregations from the aggregation result tree as they
are no longer used. This stops us from building the pipeline aggregators
at all on data nodes except for backwards compatibility serialization.
This will save a tiny bit of space in the aggregation tree which is
lovely, but the biggest benefit is that it is a step towards simplifying
pipeline aggregators.

This only does about half of the work to remove the pipeline aggs from
the tree. Removing all of it would, well, double the size of the change
and make it harder to review.
This commit is contained in:
Nik Everett 2020-04-02 16:45:12 -04:00 committed by GitHub
parent 547ab849b4
commit 54ea4f4f50
157 changed files with 533 additions and 793 deletions

View File

@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -43,8 +42,8 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
/** per shard ctor */ /** per shard ctor */
InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results, InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
assert count >= 0; assert count >= 0;
this.stats = multiFieldStatsResults; this.stats = multiFieldStatsResults;
this.results = results; this.results = results;
@ -240,7 +239,7 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
// return empty result iff all stats are null // return empty result iff all stats are null
if (aggs.isEmpty()) { 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(); RunningStats runningStats = new RunningStats();
@ -250,9 +249,9 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
if (reduceContext.isFinalReduce()) { if (reduceContext.isFinalReduce()) {
MatrixStatsResults results = new MatrixStatsResults(runningStats); 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 @Override

View File

@ -126,12 +126,12 @@ final class MatrixStatsAggregator extends MetricsAggregator {
if (valuesSources == null || bucket >= stats.size()) { if (valuesSources == null || bucket >= stats.size()) {
return buildEmptyAggregation(); 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 @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalMatrixStats(name, 0, null, null, pipelineAggregators(), metadata()); return new InternalMatrixStats(name, 0, null, null, metadata());
} }
@Override @Override

View File

@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.ParsedAggregation;
import org.elasticsearch.search.aggregations.matrix.stats.InternalMatrixStats.Fields; 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.search.aggregations.pipeline.PipelineAggregator.PipelineTree;
import org.elasticsearch.test.InternalAggregationTestCase; import org.elasticsearch.test.InternalAggregationTestCase;
@ -69,8 +68,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
} }
@Override @Override
protected InternalMatrixStats createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, protected InternalMatrixStats createTestInstance(String name, Map<String, Object> metadata) {
Map<String, Object> metadata) {
double[] values = new double[fields.length]; double[] values = new double[fields.length];
for (int i = 0; i < fields.length; i++) { for (int i = 0; i < fields.length; i++) {
values[i] = randomDouble(); values[i] = randomDouble();
@ -79,7 +77,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
RunningStats runningStats = new RunningStats(); RunningStats runningStats = new RunningStats();
runningStats.add(fields, values); runningStats.add(fields, values);
MatrixStatsResults matrixStatsResults = hasMatrixStatsResults ? new MatrixStatsResults(runningStats) : null; MatrixStatsResults matrixStatsResults = hasMatrixStatsResults ? new MatrixStatsResults(runningStats) : null;
return new InternalMatrixStats(name, 1L, runningStats, matrixStatsResults, Collections.emptyList(), metadata); return new InternalMatrixStats(name, 1L, runningStats, matrixStatsResults, metadata);
} }
@Override @Override
@ -125,7 +123,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
metadata.put(randomAlphaOfLength(15), randomInt()); metadata.put(randomAlphaOfLength(15), randomInt());
break; break;
} }
return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, Collections.emptyList(), metadata); return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, metadata);
} }
@Override @Override
@ -149,14 +147,14 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
runningStats.add(new String[]{"a", "b"}, new double[]{valueA, valueB}); runningStats.add(new String[]{"a", "b"}, new double[]{valueA, valueB});
if (++valuePerShardCounter == valuesPerShard) { if (++valuePerShardCounter == valuesPerShard) {
shardResults.add(new InternalMatrixStats("_name", 1L, runningStats, null, Collections.emptyList(), Collections.emptyMap())); shardResults.add(new InternalMatrixStats("_name", 1L, runningStats, null, Collections.emptyMap()));
runningStats = new RunningStats(); runningStats = new RunningStats();
valuePerShardCounter = 0; valuePerShardCounter = 0;
} }
} }
if (valuePerShardCounter != 0) { if (valuePerShardCounter != 0) {
shardResults.add(new InternalMatrixStats("_name", 1L, runningStats, null, Collections.emptyList(), Collections.emptyMap())); shardResults.add(new InternalMatrixStats("_name", 1L, runningStats, null, Collections.emptyMap()));
} }
MultiPassStats multiPassStats = new MultiPassStats("a", "b"); MultiPassStats multiPassStats = new MultiPassStats("a", "b");
multiPassStats.computeStats(aValues, bValues); multiPassStats.computeStats(aValues, bValues);

View File

@ -155,6 +155,19 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
* *
* @param name The name of the aggregation. * @param name The name of the aggregation.
*/ */
protected InternalAggregation(String name, Map<String, Object> 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<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
this.name = name; this.name = name;
this.pipelineAggregators = pipelineAggregators; this.pipelineAggregators = pipelineAggregators;
@ -171,6 +184,7 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
forEachBucket(bucketAggs -> bucketAggs.mergePipelineTreeForBWCSerialization(pipelineTree)); forEachBucket(bucketAggs -> bucketAggs.mergePipelineTreeForBWCSerialization(pipelineTree));
} }
/** /**
* Read from a stream. * Read from a stream.
*/ */

View File

@ -37,6 +37,14 @@ public abstract class InternalMultiBucketAggregation<A extends InternalMultiBuck
B extends InternalMultiBucketAggregation.InternalBucket> B extends InternalMultiBucketAggregation.InternalBucket>
extends InternalAggregation implements MultiBucketsAggregation { extends InternalAggregation implements MultiBucketsAggregation {
public InternalMultiBucketAggregation(String name, Map<String, Object> metadata) {
super(name, metadata);
}
/**
* @deprecated being removed
*/
@Deprecated
public InternalMultiBucketAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { public InternalMultiBucketAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, pipelineAggregators, metadata);
} }

View File

@ -181,7 +181,7 @@ public class FiltersAggregator extends BucketsAggregator {
bucketAggregations(bucketOrd), keyed); bucketAggregations(bucketOrd), keyed);
buckets.add(bucket); buckets.add(bucket);
} }
return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metadata()); return new InternalFilters(name, buckets, keyed, metadata());
} }
@Override @Override
@ -198,7 +198,7 @@ public class FiltersAggregator extends BucketsAggregator {
buckets.add(bucket); 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) { final long bucketOrd(long owningBucketOrdinal, int filterOrd) {

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -126,9 +125,8 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
// bucketMap gets lazily initialized from buckets in getBucketByKey() // bucketMap gets lazily initialized from buckets in getBucketByKey()
private transient Map<String, InternalBucket> bucketMap; private transient Map<String, InternalBucket> bucketMap;
public InternalFilters(String name, List<InternalBucket> buckets, boolean keyed, List<PipelineAggregator> pipelineAggregators, public InternalFilters(String name, List<InternalBucket> buckets, boolean keyed, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.buckets = buckets; this.buckets = buckets;
this.keyed = keyed; this.keyed = keyed;
} }
@ -164,7 +162,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
@Override @Override
public InternalFilters create(List<InternalBucket> buckets) { public InternalFilters create(List<InternalBucket> buckets) {
return new InternalFilters(this.name, buckets, this.keyed, this.pipelineAggregators(), this.metadata); return new InternalFilters(name, buckets, keyed, metadata);
} }
@Override @Override
@ -209,8 +207,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
} }
reduceContext.consumeBucketsAndMaybeBreak(bucketsList.size()); reduceContext.consumeBucketsAndMaybeBreak(bucketsList.size());
InternalFilters reduced = new InternalFilters(name, new ArrayList<>(bucketsList.size()), keyed, pipelineAggregators(), InternalFilters reduced = new InternalFilters(name, new ArrayList<>(bucketsList.size()), keyed, getMetadata());
getMetadata());
for (List<InternalBucket> sameRangeList : bucketsList) { for (List<InternalBucket> sameRangeList : bucketsList) {
reduced.buckets.add(reduceBucket(sameRangeList, reduceContext)); reduced.buckets.add(reduceBucket(sameRangeList, reduceContext));
} }

View File

@ -95,8 +95,7 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends Bucke
}; };
} }
abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
/** /**
* This method is used to return a re-usable instance of the bucket when building * This method is used to return a re-usable instance of the bucket when building
@ -132,12 +131,12 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends Bucke
bucket.aggregations = bucketAggregations(bucket.bucketOrd); bucket.aggregations = bucketAggregations(bucket.bucketOrd);
list[i] = bucket; list[i] = bucket;
} }
return buildAggregation(name, requiredSize, Arrays.asList(list), pipelineAggregators(), metadata()); return buildAggregation(name, requiredSize, Arrays.asList(list), metadata());
} }
@Override @Override
public InternalGeoGrid buildEmptyAggregation() { public InternalGeoGrid buildEmptyAggregation() {
return buildAggregation(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); return buildAggregation(name, requiredSize, Collections.emptyList(), metadata());
} }
@Override @Override

View File

@ -43,13 +43,13 @@ public class GeoHashGridAggregator extends GeoGridAggregator<InternalGeoHashGrid
@Override @Override
InternalGeoHashGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, InternalGeoHashGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators, metadata); return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override
public InternalGeoHashGrid buildEmptyAggregation() { public InternalGeoHashGrid buildEmptyAggregation() {
return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), metadata());
} }
InternalGeoGridBucket newEmptyBucket() { InternalGeoGridBucket newEmptyBucket() {

View File

@ -34,10 +34,11 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList;
public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> { public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> {
private final int precision; private final int precision;
@ -61,8 +62,7 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, emptyList(), metadata);
Collections.emptyList(), pipelineAggregators, metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {

View File

@ -44,13 +44,13 @@ public class GeoTileGridAggregator extends GeoGridAggregator<InternalGeoTileGrid
@Override @Override
InternalGeoTileGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, InternalGeoTileGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators, metadata); return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override
public InternalGeoTileGrid buildEmptyAggregation() { public InternalGeoTileGrid buildEmptyAggregation() {
return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata()); return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata());
} }
InternalGeoGridBucket newEmptyBucket() { InternalGeoGridBucket newEmptyBucket() {

View File

@ -60,8 +60,7 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata);
Collections.emptyList(), pipelineAggregators, metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {

View File

@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -48,9 +47,8 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
protected final int requiredSize; protected final int requiredSize;
protected final List<InternalGeoGridBucket> buckets; protected final List<InternalGeoGridBucket> buckets;
InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, List<PipelineAggregator> pipelineAggregators, InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.requiredSize = requiredSize; this.requiredSize = requiredSize;
this.buckets = buckets; this.buckets = buckets;
} }
@ -72,8 +70,7 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
out.writeList(buckets); out.writeList(buckets);
} }
abstract InternalGeoGrid create(String name, int requiredSize, List<InternalGeoGridBucket> buckets, abstract InternalGeoGrid create(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
@Override @Override
public List<InternalGeoGridBucket> getBuckets() { public List<InternalGeoGridBucket> getBuckets() {
@ -115,7 +112,7 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
for (int i = ordered.size() - 1; i >= 0; i--) { for (int i = ordered.size() - 1; i >= 0; i--) {
list[i] = ordered.pop(); list[i] = ordered.pop();
} }
return create(getName(), requiredSize, Arrays.asList(list), pipelineAggregators(), getMetadata()); return create(getName(), requiredSize, Arrays.asList(list), getMetadata());
} }
@Override @Override

View File

@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -33,9 +32,8 @@ import java.util.Map;
*/ */
public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBucket> { public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBucket> {
InternalGeoHashGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, InternalGeoHashGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, requiredSize, buckets, metadata);
super(name, requiredSize, buckets, pipelineAggregators, metadata);
} }
public InternalGeoHashGrid(StreamInput in) throws IOException { public InternalGeoHashGrid(StreamInput in) throws IOException {
@ -44,7 +42,7 @@ public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBuck
@Override @Override
public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) { public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) {
return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators(), metadata); return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override
@ -53,8 +51,8 @@ public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBuck
} }
@Override @Override
InternalGeoGrid create(String name, int requiredSize, List buckets, List list, Map metadata) { InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata) {
return new InternalGeoHashGrid(name, requiredSize, buckets, list, metadata); return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override

View File

@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -33,9 +32,8 @@ import java.util.Map;
*/ */
public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBucket> { public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBucket> {
InternalGeoTileGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, InternalGeoTileGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, requiredSize, buckets, metadata);
super(name, requiredSize, buckets, pipelineAggregators, metadata);
} }
public InternalGeoTileGrid(StreamInput in) throws IOException { public InternalGeoTileGrid(StreamInput in) throws IOException {
@ -44,7 +42,7 @@ public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBuck
@Override @Override
public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) { public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) {
return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators(), metadata); return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override
@ -53,8 +51,8 @@ public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBuck
} }
@Override @Override
InternalGeoGrid create(String name, int requiredSize, List buckets, List list, Map metadata) { InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata) {
return new InternalGeoTileGrid(name, requiredSize, buckets, list, metadata); return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
} }
@Override @Override

View File

@ -148,8 +148,8 @@ class DateHistogramAggregator extends BucketsAggregator {
InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0 InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0
? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds) ? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds)
: null; : null;
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, keyed, return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
pipelineAggregators(), metadata()); keyed, metadata());
} }
@Override @Override
@ -158,7 +158,7 @@ class DateHistogramAggregator extends BucketsAggregator {
? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds) ? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds)
: null; : null;
return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
keyed, pipelineAggregators(), metadata()); keyed, metadata());
} }
@Override @Override

View File

@ -169,8 +169,8 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0 InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0
? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds) ? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds)
: null; : null;
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, keyed, return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
pipelineAggregators(), metadata()); keyed, metadata());
} }
@Override @Override
@ -179,7 +179,7 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds) ? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds)
: null; : null;
return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
keyed, pipelineAggregators(), metadata()); keyed, metadata());
} }
@Override @Override

View File

@ -33,7 +33,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
@ -211,10 +210,8 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
final EmptyBucketInfo emptyBucketInfo; final EmptyBucketInfo emptyBucketInfo;
InternalDateHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, long offset, InternalDateHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, long offset,
EmptyBucketInfo emptyBucketInfo, EmptyBucketInfo emptyBucketInfo, DocValueFormat formatter, boolean keyed, Map<String, Object> metadata) {
DocValueFormat formatter, boolean keyed, List<PipelineAggregator> pipelineAggregators, super(name, metadata);
Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata);
this.buckets = buckets; this.buckets = buckets;
this.order = order; this.order = order;
this.offset = offset; this.offset = offset;
@ -284,8 +281,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
@Override @Override
public InternalDateHistogram create(List<Bucket> buckets) { public InternalDateHistogram create(List<Bucket> buckets) {
return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, keyed, metadata);
keyed, pipelineAggregators(), metadata);
} }
@Override @Override
@ -467,7 +463,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
} }
} }
return new InternalDateHistogram(getName(), reducedBuckets, order, minDocCount, offset, emptyBucketInfo, return new InternalDateHistogram(getName(), reducedBuckets, order, minDocCount, offset, emptyBucketInfo,
format, keyed, pipelineAggregators(), getMetadata()); format, keyed, getMetadata());
} }
@Override @Override
@ -508,8 +504,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
buckets2.add((Bucket) b); buckets2.add((Bucket) b);
} }
buckets2 = Collections.unmodifiableList(buckets2); buckets2 = Collections.unmodifiableList(buckets2);
return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format, return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format, keyed, getMetadata());
keyed, pipelineAggregators(), getMetadata());
} }
@Override @Override

View File

@ -32,7 +32,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -205,9 +204,8 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
final EmptyBucketInfo emptyBucketInfo; final EmptyBucketInfo emptyBucketInfo;
InternalHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, EmptyBucketInfo emptyBucketInfo, InternalHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, EmptyBucketInfo emptyBucketInfo,
DocValueFormat formatter, boolean keyed, List<PipelineAggregator> pipelineAggregators, DocValueFormat formatter, boolean keyed, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.buckets = buckets; this.buckets = buckets;
this.order = order; this.order = order;
assert (minDocCount == 0) == (emptyBucketInfo != null); assert (minDocCount == 0) == (emptyBucketInfo != null);
@ -266,7 +264,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
@Override @Override
public InternalHistogram create(List<Bucket> buckets) { public InternalHistogram create(List<Bucket> 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 @Override
@ -439,8 +437,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
CollectionUtil.introSort(reducedBuckets, order.comparator()); CollectionUtil.introSort(reducedBuckets, order.comparator());
} }
} }
return new InternalHistogram(getName(), reducedBuckets, order, minDocCount, emptyBucketInfo, format, keyed, pipelineAggregators(), return new InternalHistogram(getName(), reducedBuckets, order, minDocCount, emptyBucketInfo, format, keyed, getMetadata());
getMetadata());
} }
@Override @Override
@ -481,8 +478,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
buckets2.add((Bucket) b); buckets2.add((Bucket) b);
} }
buckets2 = Collections.unmodifiableList(buckets2); buckets2 = Collections.unmodifiableList(buckets2);
return new InternalHistogram(name, buckets2, order, minDocCount, emptyBucketInfo, format, return new InternalHistogram(name, buckets2, order, minDocCount, emptyBucketInfo, format, keyed, getMetadata());
keyed, pipelineAggregators(), getMetadata());
} }
@Override @Override

View File

@ -150,8 +150,7 @@ class NumericHistogramAggregator extends BucketsAggregator {
if (minDocCount == 0) { if (minDocCount == 0) {
emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
} }
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(), return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
metadata());
} }
@Override @Override
@ -160,8 +159,7 @@ class NumericHistogramAggregator extends BucketsAggregator {
if (minDocCount == 0) { if (minDocCount == 0) {
emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
} }
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
pipelineAggregators(), metadata());
} }
@Override @Override

View File

@ -154,8 +154,7 @@ public class RangeHistogramAggregator extends BucketsAggregator {
if (minDocCount == 0) { if (minDocCount == 0) {
emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
} }
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(), return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
metadata());
} }
@Override @Override
@ -164,8 +163,7 @@ public class RangeHistogramAggregator extends BucketsAggregator {
if (minDocCount == 0) { if (minDocCount == 0) {
emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations()); emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
} }
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
pipelineAggregators(), metadata());
} }
@Override @Override

View File

@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValueType;
import java.io.IOException; import java.io.IOException;
@ -88,14 +87,14 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
@Override @Override
public InternalDateRange create(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed, public InternalDateRange create(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalDateRange(name, ranges, formatter, keyed, pipelineAggregators, metadata); return new InternalDateRange(name, ranges, formatter, keyed, metadata);
} }
@Override @Override
public InternalDateRange create(List<Bucket> ranges, InternalDateRange prototype) { public InternalDateRange create(List<Bucket> ranges, InternalDateRange prototype) {
return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(), return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata);
prototype.metadata);
} }
@Override @Override
@ -112,8 +111,8 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
} }
InternalDateRange(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed, InternalDateRange(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, ranges, formatter, keyed, pipelineAggregators, metadata); super(name, ranges, formatter, keyed, metadata);
} }
/** /**

View File

@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; 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.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValueType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -67,14 +66,13 @@ public class InternalGeoDistance extends InternalRange<InternalGeoDistance.Bucke
@Override @Override
public InternalGeoDistance create(String name, List<Bucket> ranges, DocValueFormat format, boolean keyed, public InternalGeoDistance create(String name, List<Bucket> ranges, DocValueFormat format, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalGeoDistance(name, ranges, keyed, pipelineAggregators, metadata); return new InternalGeoDistance(name, ranges, keyed, metadata);
} }
@Override @Override
public InternalGeoDistance create(List<Bucket> ranges, InternalGeoDistance prototype) { public InternalGeoDistance create(List<Bucket> ranges, InternalGeoDistance prototype) {
return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.pipelineAggregators(), return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.metadata);
prototype.metadata);
} }
@Override @Override
@ -90,10 +88,8 @@ public class InternalGeoDistance extends InternalRange<InternalGeoDistance.Bucke
} }
} }
public InternalGeoDistance(String name, List<Bucket> ranges, boolean keyed, public InternalGeoDistance(String name, List<Bucket> ranges, boolean keyed, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, super(name, ranges, DocValueFormat.RAW, keyed, metadata);
Map<String, Object> metadata) {
super(name, ranges, DocValueFormat.RAW, keyed, pipelineAggregators, metadata);
} }
/** /**

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; 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.CoreValuesSourceType;
import org.elasticsearch.search.aggregations.support.ValueType; import org.elasticsearch.search.aggregations.support.ValueType;
import org.elasticsearch.search.aggregations.support.ValuesSourceType; import org.elasticsearch.search.aggregations.support.ValuesSourceType;
@ -202,9 +201,8 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public R create(String name, List<B> ranges, DocValueFormat format, boolean keyed, List<PipelineAggregator> pipelineAggregators, public R create(String name, List<B> ranges, DocValueFormat format, boolean keyed, Map<String, Object> metadata) {
Map<String, Object> metadata) { return (R) new InternalRange<B, R>(name, ranges, format, keyed, metadata);
return (R) new InternalRange<B, R>(name, ranges, format, keyed, pipelineAggregators, metadata);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -215,8 +213,7 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public R create(List<B> ranges, R prototype) { public R create(List<B> ranges, R prototype) {
return (R) new InternalRange<B, R>(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(), return (R) new InternalRange<B, R>(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata);
prototype.metadata);
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -230,10 +227,8 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
protected final DocValueFormat format; protected final DocValueFormat format;
protected final boolean keyed; protected final boolean keyed;
public InternalRange(String name, List<B> ranges, DocValueFormat format, boolean keyed, public InternalRange(String name, List<B> ranges, DocValueFormat format, boolean keyed, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, super(name, metadata);
Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata);
this.ranges = ranges; this.ranges = ranges;
this.format = format; this.format = format;
this.keyed = keyed; this.keyed = keyed;
@ -313,7 +308,7 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
for (int i = 0; i < this.ranges.size(); ++i) { for (int i = 0; i < this.ranges.size(); ++i) {
ranges.add((B) reduceBucket(rangeList[i], reduceContext)); ranges.add((B) reduceBucket(rangeList[i], reduceContext));
} }
return getFactory().create(name, ranges, format, keyed, pipelineAggregators(), getMetadata()); return getFactory().create(name, ranges, format, keyed, getMetadata());
} }
@Override @Override

View File

@ -338,7 +338,7 @@ public class RangeAggregator extends BucketsAggregator {
buckets.add(bucket); buckets.add(bucket);
} }
// value source can be null in the case of unmapped fields // value source can be null in the case of unmapped fields
return rangeFactory.create(name, buckets, format, keyed, pipelineAggregators(), metadata()); return rangeFactory.create(name, buckets, format, keyed, metadata());
} }
@Override @Override
@ -352,7 +352,7 @@ public class RangeAggregator extends BucketsAggregator {
buckets.add(bucket); buckets.add(bucket);
} }
// value source can be null in the case of unmapped fields // value source can be null in the case of unmapped fields
return rangeFactory.create(name, buckets, format, keyed, pipelineAggregators(), metadata()); return rangeFactory.create(name, buckets, format, keyed, metadata());
} }
public static class Unmapped<R extends RangeAggregator.Range> extends NonCollectingAggregator { public static class Unmapped<R extends RangeAggregator.Range> extends NonCollectingAggregator {
@ -380,7 +380,7 @@ public class RangeAggregator extends BucketsAggregator {
for (RangeAggregator.Range range : ranges) { for (RangeAggregator.Range range : ranges) {
buckets.add(factory.createBucket(range.key, range.from, range.to, 0, subAggs, keyed, format)); 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());
} }
} }

View File

@ -162,7 +162,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
} }
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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 @Override
@ -172,7 +172,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
IndexReader topReader = searcher.getIndexReader(); IndexReader topReader = searcher.getIndexReader();
int supersetSize = topReader.numDocs(); int supersetSize = topReader.numDocs();
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
pipelineAggregators(), metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList()); metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList());
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
@ -46,10 +45,10 @@ public abstract class InternalMappedSignificantTerms<
protected final List<B> buckets; protected final List<B> buckets;
protected Map<String, B> bucketMap; protected Map<String, B> bucketMap;
protected InternalMappedSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, protected InternalMappedSignificantTerms(String name, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize, Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize,
SignificanceHeuristic significanceHeuristic, List<B> buckets) { SignificanceHeuristic significanceHeuristic, List<B> buckets) {
super(name, requiredSize, minDocCount, pipelineAggregators, metadata); super(name, requiredSize, minDocCount, metadata);
this.format = format; this.format = format;
this.buckets = buckets; this.buckets = buckets;
this.subsetSize = subsetSize; this.subsetSize = subsetSize;

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -166,9 +165,8 @@ public abstract class InternalSignificantTerms<A extends InternalSignificantTerm
protected final int requiredSize; protected final int requiredSize;
protected final long minDocCount; protected final long minDocCount;
protected InternalSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, protected InternalSignificantTerms(String name, int requiredSize, long minDocCount, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.requiredSize = requiredSize; this.requiredSize = requiredSize;
this.minDocCount = minDocCount; this.minDocCount = minDocCount;
} }

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -101,10 +100,10 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<Signifi
} }
} }
public SignificantLongTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public SignificantLongTerms(String name, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize, Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize,
SignificanceHeuristic significanceHeuristic, List<Bucket> buckets) { SignificanceHeuristic significanceHeuristic, List<Bucket> buckets) {
super(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, supersetSize, significanceHeuristic, super(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic,
buckets); buckets);
} }
@ -122,7 +121,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<Signifi
@Override @Override
public SignificantLongTerms create(List<SignificantLongTerms.Bucket> buckets) { public SignificantLongTerms create(List<SignificantLongTerms.Bucket> buckets) {
return new SignificantLongTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata, format, subsetSize, supersetSize, return new SignificantLongTerms(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize,
significanceHeuristic, buckets); significanceHeuristic, buckets);
} }
@ -134,7 +133,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<Signifi
@Override @Override
protected SignificantLongTerms create(long subsetSize, long supersetSize, List<Bucket> buckets) { protected SignificantLongTerms create(long subsetSize, long supersetSize, List<Bucket> buckets) {
return new SignificantLongTerms(getName(), requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, subsetSize, return new SignificantLongTerms(getName(), requiredSize, minDocCount, getMetadata(), format, subsetSize,
supersetSize, significanceHeuristic, buckets); supersetSize, significanceHeuristic, buckets);
} }

View File

@ -121,7 +121,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
} }
return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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 @Override
@ -131,7 +131,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
IndexReader topReader = searcher.getIndexReader(); IndexReader topReader = searcher.getIndexReader();
int supersetSize = topReader.numDocs(); int supersetSize = topReader.numDocs();
return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
} }
@Override @Override

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -106,11 +105,10 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
} }
} }
public SignificantStringTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public SignificantStringTerms(String name, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize, Map<String, Object> metadata, DocValueFormat format, long subsetSize, long supersetSize,
SignificanceHeuristic significanceHeuristic, List<Bucket> buckets) { SignificanceHeuristic significanceHeuristic, List<Bucket> buckets) {
super(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, supersetSize, significanceHeuristic, super(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets);
buckets);
} }
/** /**
@ -127,7 +125,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
@Override @Override
public SignificantStringTerms create(List<SignificantStringTerms.Bucket> buckets) { public SignificantStringTerms create(List<SignificantStringTerms.Bucket> buckets) {
return new SignificantStringTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata, format, subsetSize, return new SignificantStringTerms(name, requiredSize, minDocCount, metadata, format, subsetSize,
supersetSize, significanceHeuristic, buckets); supersetSize, significanceHeuristic, buckets);
} }
@ -139,7 +137,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
@Override @Override
protected SignificantStringTerms create(long subsetSize, long supersetSize, List<Bucket> buckets) { protected SignificantStringTerms create(long subsetSize, long supersetSize, List<Bucket> buckets) {
return new SignificantStringTerms(getName(), requiredSize, minDocCount, pipelineAggregators(), getMetadata(), format, subsetSize, return new SignificantStringTerms(getName(), requiredSize, minDocCount, getMetadata(), format, subsetSize,
supersetSize, significanceHeuristic, buckets); supersetSize, significanceHeuristic, buckets);
} }

View File

@ -130,7 +130,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator {
} }
return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(), return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(),
bucketCountThresholds.getMinDocCount(), pipelineAggregators(), bucketCountThresholds.getMinDocCount(),
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
} }
@ -141,7 +141,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator {
IndexReader topReader = searcher.getIndexReader(); IndexReader topReader = searcher.getIndexReader();
int supersetSize = topReader.numDocs(); int supersetSize = topReader.numDocs();
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
} }
@Override @Override

View File

@ -167,7 +167,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
List<PipelineAggregator> pipelineAggregators, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(), final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(),
bucketCountThresholds.getMinDocCount(), pipelineAggregators, metadata); bucketCountThresholds.getMinDocCount(), metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {

View File

@ -232,7 +232,7 @@ public class SignificantTextAggregator extends BucketsAggregator {
} }
return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(), return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(),
bucketCountThresholds.getMinDocCount(), pipelineAggregators(), bucketCountThresholds.getMinDocCount(),
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list)); metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
} }
@ -244,7 +244,7 @@ public class SignificantTextAggregator extends BucketsAggregator {
IndexReader topReader = searcher.getIndexReader(); IndexReader topReader = searcher.getIndexReader();
int supersetSize = topReader.numDocs(); int supersetSize = topReader.numDocs();
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList()); metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
} }
@Override @Override

View File

@ -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.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.bucket.terms.InternalTerms; import org.elasticsearch.search.aggregations.bucket.terms.InternalTerms;
import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms; import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
@ -56,9 +55,8 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
} }
} }
public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, requiredSize, minDocCount, metadata);
super(name, requiredSize, minDocCount, pipelineAggregators, metadata);
} }
/** /**
@ -85,7 +83,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
@Override @Override
public UnmappedSignificantTerms create(List<Bucket> buckets) { public UnmappedSignificantTerms create(List<Bucket> buckets) {
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata); return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata);
} }
@Override @Override
@ -106,7 +104,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
@Override @Override
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata); return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata);
} }
@Override @Override

View File

@ -22,9 +22,9 @@ package org.elasticsearch.search.aggregations.bucket.terms;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -47,7 +47,7 @@ abstract class AbstractStringTermsAggregator extends TermsAggregator {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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);
} }
} }

View File

@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; 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.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -101,10 +100,10 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
} }
} }
public DoubleTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public DoubleTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount,
List<Bucket> buckets, long docCountError) { List<Bucket> 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); otherDocCount, buckets, docCountError);
} }
@ -122,7 +121,7 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
@Override @Override
public DoubleTerms create(List<Bucket> buckets) { public DoubleTerms create(List<Bucket> 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); showTermDocCountError, otherDocCount, buckets, docCountError);
} }
@ -134,7 +133,7 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
@Override @Override
protected DoubleTerms create(String name, List<Bucket> buckets, long docCountError, long otherDocCount) { protected DoubleTerms create(String name, List<Bucket> 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); shardSize, showTermDocCountError, otherDocCount, buckets, docCountError);
} }

View File

@ -65,7 +65,7 @@ public class DoubleTermsAggregator extends LongTermsAggregator {
private static DoubleTerms convertToDouble(LongTerms terms) { private static DoubleTerms convertToDouble(LongTerms terms) {
List<DoubleTerms.Bucket> buckets = terms.buckets.stream().map(DoubleTermsAggregator::convertToDouble).collect(Collectors.toList()); List<DoubleTerms.Bucket> 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.getMetadata(), terms.format, terms.shardSize, terms.showTermDocCountError, terms.otherDocCount, buckets,
terms.docCountError); terms.docCountError);
} }

View File

@ -240,7 +240,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
} }
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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); otherDocCount, Arrays.asList(list), 0);
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import java.io.IOException; import java.io.IOException;
@ -47,9 +46,9 @@ public abstract class InternalMappedTerms<A extends InternalTerms<A, B>, B exten
protected long docCountError; protected long docCountError;
protected InternalMappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, protected InternalMappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, DocValueFormat format, int shardSize, Map<String, Object> metadata, DocValueFormat format, int shardSize,
boolean showTermDocCountError, long otherDocCount, List<B> buckets, long docCountError) { boolean showTermDocCountError, long otherDocCount, List<B> buckets, long docCountError) {
super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata); super(name, order, requiredSize, minDocCount, metadata);
this.format = format; this.format = format;
this.shardSize = shardSize; this.shardSize = shardSize;
this.showTermDocCountError = showTermDocCountError; this.showTermDocCountError = showTermDocCountError;

View File

@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -157,9 +156,8 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
protected final int requiredSize; protected final int requiredSize;
protected final long minDocCount; protected final long minDocCount;
protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.order = order; this.order = order;
this.requiredSize = requiredSize; this.requiredSize = requiredSize;
this.minDocCount = minDocCount; this.minDocCount = minDocCount;

View File

@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; 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.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -101,10 +100,10 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
} }
} }
public LongTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public LongTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount,
List<Bucket> buckets, long docCountError) { List<Bucket> 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); otherDocCount, buckets, docCountError);
} }
@ -122,7 +121,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
@Override @Override
public LongTerms create(List<Bucket> buckets) { public LongTerms create(List<Bucket> 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); showTermDocCountError, otherDocCount, buckets, docCountError);
} }
@ -134,7 +133,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
@Override @Override
protected LongTerms create(String name, List<Bucket> buckets, long docCountError, long otherDocCount) { protected LongTerms create(String name, List<Bucket> 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); showTermDocCountError, otherDocCount, buckets, docCountError);
} }
@ -170,7 +169,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
longTerms.showTermDocCountError ? bucket.getDocCountError() : 0, decimalFormat)); longTerms.showTermDocCountError ? bucket.getDocCountError() : 0, decimalFormat));
} }
return new DoubleTerms(longTerms.getName(), longTerms.order, longTerms.requiredSize, return new DoubleTerms(longTerms.getName(), longTerms.order, longTerms.requiredSize,
longTerms.minDocCount, longTerms.pipelineAggregators(), longTerms.minDocCount,
longTerms.metadata, longTerms.format, longTerms.shardSize, longTerms.metadata, longTerms.format, longTerms.shardSize,
longTerms.showTermDocCountError, longTerms.otherDocCount, longTerms.showTermDocCountError, longTerms.otherDocCount,
newBuckets, longTerms.docCountError); newBuckets, longTerms.docCountError);

View File

@ -26,13 +26,13 @@ import org.elasticsearch.common.util.LongHash;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator; 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.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -169,14 +169,14 @@ public class LongTermsAggregator extends TermsAggregator {
} }
return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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); Arrays.asList(list), 0);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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 @Override

View File

@ -23,9 +23,8 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; 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.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregations;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -104,10 +103,10 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
} }
} }
public StringTerms(String name, BucketOrder order, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators, public StringTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount, Map<String, Object> metadata, DocValueFormat format, int shardSize, boolean showTermDocCountError, long otherDocCount,
List<Bucket> buckets, long docCountError) { List<Bucket> buckets, long docCountError) {
super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata, format, super(name, order, requiredSize, minDocCount, metadata, format,
shardSize, showTermDocCountError, otherDocCount, buckets, docCountError); shardSize, showTermDocCountError, otherDocCount, buckets, docCountError);
} }
@ -125,7 +124,7 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
@Override @Override
public StringTerms create(List<Bucket> buckets) { public StringTerms create(List<Bucket> 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); showTermDocCountError, otherDocCount, buckets, docCountError);
} }
@ -142,7 +141,7 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
@Override @Override
protected StringTerms create(String name, List<Bucket> buckets, long docCountError, long otherDocCount) { protected StringTerms create(String name, List<Bucket> 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); showTermDocCountError, otherDocCount, buckets, docCountError);
} }

View File

@ -176,7 +176,7 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator {
} }
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(), 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); Arrays.asList(list), 0);
} }

View File

@ -86,7 +86,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
List<PipelineAggregator> pipelineAggregators, List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(), 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) { Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {

View File

@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -51,9 +50,8 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
} }
} }
public UnmappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, public UnmappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, order, requiredSize, minDocCount, metadata);
super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata);
} }
/** /**
@ -80,7 +78,7 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
@Override @Override
public UnmappedTerms create(List<Bucket> buckets) { public UnmappedTerms create(List<Bucket> buckets) {
return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata); return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata);
} }
@Override @Override
@ -100,7 +98,7 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
@Override @Override
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata); return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata);
} }
@Override @Override

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -42,9 +41,8 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
protected final boolean keyed; protected final boolean keyed;
AbstractInternalHDRPercentiles(String name, double[] keys, DoubleHistogram state, boolean keyed, DocValueFormat format, AbstractInternalHDRPercentiles(String name, double[] keys, DoubleHistogram state, boolean keyed, DocValueFormat format,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.keys = keys; this.keys = keys;
this.state = state; this.state = state;
this.keyed = keyed; this.keyed = keyed;
@ -113,11 +111,11 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
} }
merged.add(percentiles.state); 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, protected abstract AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata); Map<String, Object> metadata);
@Override @Override
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException { public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {

View File

@ -117,12 +117,12 @@ class AvgAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSource == null || bucket >= sums.size()) { if (valuesSource == null || bucket >= sums.size()) {
return buildEmptyAggregation(); 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 @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata()); return new InternalAvg(name, 0.0, 0L, format, metadata());
} }
@Override @Override

View File

@ -150,12 +150,12 @@ class CardinalityAggregator extends NumericMetricsAggregator.SingleValue {
// this Aggregator (and its HLL++ counters) is released. // this Aggregator (and its HLL++ counters) is released.
HyperLogLogPlusPlus copy = new HyperLogLogPlusPlus(precision, BigArrays.NON_RECYCLING_INSTANCE, 1); HyperLogLogPlusPlus copy = new HyperLogLogPlusPlus(precision, BigArrays.NON_RECYCLING_INSTANCE, 1);
copy.merge(0, counts, owningBucketOrdinal); copy.merge(0, counts, owningBucketOrdinal);
return new InternalCardinality(name, copy, pipelineAggregators(), metadata()); return new InternalCardinality(name, copy, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalCardinality(name, null, pipelineAggregators(), metadata()); return new InternalCardinality(name, null, metadata());
} }
@Override @Override

View File

@ -205,13 +205,12 @@ class ExtendedStatsAggregator extends NumericMetricsAggregator.MultiValue {
} }
return new InternalExtendedStats(name, counts.get(bucket), sums.get(bucket), return new InternalExtendedStats(name, counts.get(bucket), sums.get(bucket),
mins.get(bucket), maxes.get(bucket), sumOfSqrs.get(bucket), sigma, format, mins.get(bucket), maxes.get(bucket), sumOfSqrs.get(bucket), sigma, format,
pipelineAggregators(), metadata()); metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d, return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d, sigma, format, metadata());
sigma, format, pipelineAggregators(), metadata());
} }
@Override @Override

View File

@ -45,7 +45,7 @@ class HDRPercentileRanksAggregator extends AbstractHDRPercentilesAggregator {
if (state == null) { if (state == null) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} else { } 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; DoubleHistogram state;
state = new DoubleHistogram(numberOfSignificantValueDigits); state = new DoubleHistogram(numberOfSignificantValueDigits);
state.setAutoResize(true); state.setAutoResize(true);
return new InternalHDRPercentileRanks(name, keys, state, return new InternalHDRPercentileRanks(name, keys, state, keyed, format, metadata());
keyed, format, pipelineAggregators(), metadata());
} }
@Override @Override

View File

@ -45,7 +45,7 @@ class HDRPercentilesAggregator extends AbstractHDRPercentilesAggregator {
if (state == null) { if (state == null) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} else { } 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; DoubleHistogram state;
state = new DoubleHistogram(numberOfSignificantValueDigits); state = new DoubleHistogram(numberOfSignificantValueDigits);
state.setAutoResize(true); state.setAutoResize(true);
return new InternalHDRPercentiles(name, keys, state, return new InternalHDRPercentiles(name, keys, state, keyed, format, metadata());
keyed,
format, pipelineAggregators(), metadata());
} }
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -34,9 +33,8 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i
private final double sum; private final double sum;
private final long count; private final long count;
public InternalAvg(String name, double sum, long count, DocValueFormat format, List<PipelineAggregator> pipelineAggregators, public InternalAvg(String name, double sum, long count, DocValueFormat format, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.sum = sum; this.sum = sum;
this.count = count; this.count = count;
this.format = format; this.format = format;
@ -97,7 +95,7 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i
count += avg.count; count += avg.count;
kahanSummation.add(avg.sum); kahanSummation.add(avg.sum);
} }
return new InternalAvg(getName(), kahanSummation.value(), count, format, pipelineAggregators(), getMetadata()); return new InternalAvg(getName(), kahanSummation.value(), count, format, getMetadata());
} }
@Override @Override

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -35,9 +34,8 @@ import java.util.Objects;
public final class InternalCardinality extends InternalNumericMetricsAggregation.SingleValue implements Cardinality { public final class InternalCardinality extends InternalNumericMetricsAggregation.SingleValue implements Cardinality {
private final HyperLogLogPlusPlus counts; private final HyperLogLogPlusPlus counts;
InternalCardinality(String name, HyperLogLogPlusPlus counts, List<PipelineAggregator> pipelineAggregators, InternalCardinality(String name, HyperLogLogPlusPlus counts, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.counts = counts; this.counts = counts;
} }
@ -92,7 +90,7 @@ public final class InternalCardinality extends InternalNumericMetricsAggregation
if (cardinality.counts != null) { if (cardinality.counts != null) {
if (reduced == null) { if (reduced == null) {
reduced = new InternalCardinality(name, new HyperLogLogPlusPlus(cardinality.counts.precision(), 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); reduced.merge(cardinality);
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -44,8 +43,8 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat
private final double sigma; private final double sigma;
public InternalExtendedStats(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma, public InternalExtendedStats(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma,
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { DocValueFormat formatter, Map<String, Object> metadata) {
super(name, count, sum, min, max, formatter, pipelineAggregators, metadata); super(name, count, sum, min, max, formatter, metadata);
this.sumOfSqrs = sumOfSqrs; this.sumOfSqrs = sumOfSqrs;
this.sigma = sigma; this.sigma = sigma;
} }
@ -160,7 +159,7 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat
} }
final InternalStats stats = super.reduce(aggregations, reduceContext); final InternalStats stats = super.reduce(aggregations, reduceContext);
return new InternalExtendedStats(name, stats.getCount(), stats.getSum(), stats.getMin(), stats.getMax(), sumOfSqrs, sigma, return new InternalExtendedStats(name, stats.getCount(), stats.getSum(), stats.getMin(), stats.getMax(), sumOfSqrs, sigma,
format, pipelineAggregators(), getMetadata()); format, getMetadata());
} }
static class Fields { static class Fields {

View File

@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics;
import org.HdrHistogram.DoubleHistogram; import org.HdrHistogram.DoubleHistogram;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles implements PercentileRanks { public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles implements PercentileRanks {
public static final String NAME = "hdr_percentile_ranks"; public static final String NAME = "hdr_percentile_ranks";
InternalHDRPercentileRanks(String name, double[] cdfValues, DoubleHistogram state, boolean keyed, DocValueFormat formatter, InternalHDRPercentileRanks(String name, double[] cdfValues, DoubleHistogram state, boolean keyed, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, cdfValues, state, keyed, formatter, pipelineAggregators, metadata); super(name, cdfValues, state, keyed, formatter, metadata);
} }
/** /**
@ -70,8 +68,8 @@ public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles i
@Override @Override
protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed, protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, pipelineAggregators, metadata); return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, metadata);
} }
static double percentileRank(DoubleHistogram state, double value) { static double percentileRank(DoubleHistogram state, double value) {

View File

@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics;
import org.HdrHistogram.DoubleHistogram; import org.HdrHistogram.DoubleHistogram;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles implements Percentiles { public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles implements Percentiles {
public static final String NAME = "hdr_percentiles"; public static final String NAME = "hdr_percentiles";
InternalHDRPercentiles(String name, double[] percents, DoubleHistogram state, boolean keyed, DocValueFormat formatter, InternalHDRPercentiles(String name, double[] percents, DoubleHistogram state, boolean keyed, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, percents, state, keyed, formatter, pipelineAggregators, metadata); super(name, percents, state, keyed, formatter, metadata);
} }
/** /**
@ -73,8 +71,8 @@ public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles imple
@Override @Override
protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed, protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalHDRPercentiles(name, keys, merged, keyed, format, pipelineAggregators, metadata); return new InternalHDRPercentiles(name, keys, merged, keyed, format, metadata);
} }
public static class Iter implements Iterator<Percentile> { public static class Iter implements Iterator<Percentile> {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -33,9 +32,8 @@ import java.util.Objects;
public class InternalMax extends InternalNumericMetricsAggregation.SingleValue implements Max { public class InternalMax extends InternalNumericMetricsAggregation.SingleValue implements Max {
private final double max; private final double max;
public InternalMax(String name, double max, DocValueFormat formatter, public InternalMax(String name, double max, DocValueFormat formatter, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.format = formatter; this.format = formatter;
this.max = max; this.max = max;
} }
@ -76,7 +74,7 @@ public class InternalMax extends InternalNumericMetricsAggregation.SingleValue i
for (InternalAggregation aggregation : aggregations) { for (InternalAggregation aggregation : aggregations) {
max = Math.max(max, ((InternalMax) aggregation).max); max = Math.max(max, ((InternalMax) aggregation).max);
} }
return new InternalMax(name, max, format, pipelineAggregators(), getMetadata()); return new InternalMax(name, max, format, getMetadata());
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -52,13 +51,8 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre
private final TDigestState valuesSketch; private final TDigestState valuesSketch;
private final double medianAbsoluteDeviation; private final double medianAbsoluteDeviation;
InternalMedianAbsoluteDeviation(String name, InternalMedianAbsoluteDeviation(String name, Map<String, Object> metadata, DocValueFormat format, TDigestState valuesSketch) {
List<PipelineAggregator> pipelineAggregators, super(name, metadata);
Map<String, Object> metadata,
DocValueFormat format,
TDigestState valuesSketch) {
super(name, pipelineAggregators, metadata);
this.format = Objects.requireNonNull(format); this.format = Objects.requireNonNull(format);
this.valuesSketch = Objects.requireNonNull(valuesSketch); this.valuesSketch = Objects.requireNonNull(valuesSketch);
@ -87,7 +81,7 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre
valueMerged.add(madAggregation.valuesSketch); valueMerged.add(madAggregation.valuesSketch);
} }
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata, format, valueMerged); return new InternalMedianAbsoluteDeviation(name, metadata, format, valueMerged);
} }
@Override @Override

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -33,9 +32,8 @@ import java.util.Objects;
public class InternalMin extends InternalNumericMetricsAggregation.SingleValue implements Min { public class InternalMin extends InternalNumericMetricsAggregation.SingleValue implements Min {
private final double min; private final double min;
public InternalMin(String name, double min, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, public InternalMin(String name, double min, DocValueFormat formatter, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.min = min; this.min = min;
this.format = formatter; this.format = formatter;
} }
@ -76,7 +74,7 @@ public class InternalMin extends InternalNumericMetricsAggregation.SingleValue i
for (InternalAggregation aggregation : aggregations) { for (InternalAggregation aggregation : aggregations) {
min = Math.min(min, ((InternalMin) aggregation).min); 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 @Override

View File

@ -37,8 +37,8 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
protected DocValueFormat format = DEFAULT_FORMAT; protected DocValueFormat format = DEFAULT_FORMAT;
public abstract static class SingleValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.SingleValue { public abstract static class SingleValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.SingleValue {
protected SingleValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected SingleValue(String name, Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
} }
/** /**
@ -76,6 +76,14 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
} }
public abstract static class MultiValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.MultiValue { public abstract static class MultiValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.MultiValue {
protected MultiValue(String name, Map<String, Object> metadata) {
super(name, metadata);
}
/**
* @deprecated prefer the other ctor, the pipeline aggregators aren't used
*/
@Deprecated
protected MultiValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected MultiValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, pipelineAggregators, metadata);
} }
@ -113,8 +121,16 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
} }
} }
private InternalNumericMetricsAggregation(String name, Map<String, Object> metadata) {
super(name, metadata);
}
/**
* @deprecated prefer the other ctor, the pipeline aggregators aren't used
*/
@Deprecated
private InternalNumericMetricsAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { private InternalNumericMetricsAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
} }
/** /**

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -46,8 +45,8 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue
protected final double sum; protected final double sum;
public InternalStats(String name, long count, double sum, double min, double max, DocValueFormat formatter, public InternalStats(String name, long count, double sum, double min, double max, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.count = count; this.count = count;
this.sum = sum; this.sum = sum;
this.min = min; this.min = min;
@ -160,7 +159,7 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue
// accurate than naive summation. // accurate than naive summation.
kahanSummation.add(stats.getSum()); 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 { static class Fields {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -33,9 +32,8 @@ import java.util.Objects;
public class InternalSum extends InternalNumericMetricsAggregation.SingleValue implements Sum { public class InternalSum extends InternalNumericMetricsAggregation.SingleValue implements Sum {
private final double sum; private final double sum;
InternalSum(String name, double sum, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, InternalSum(String name, double sum, DocValueFormat formatter, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.sum = sum; this.sum = sum;
this.format = formatter; this.format = formatter;
} }
@ -79,7 +77,7 @@ public class InternalSum extends InternalNumericMetricsAggregation.SingleValue i
double value = ((InternalSum) aggregation).sum; double value = ((InternalSum) aggregation).sum;
kahanSummation.add(value); kahanSummation.add(value);
} }
return new InternalSum(name, kahanSummation.value(), format, pipelineAggregators(), getMetadata()); return new InternalSum(name, kahanSummation.value(), format, getMetadata());
} }
@Override @Override

View File

@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput; import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -35,9 +34,8 @@ import java.util.Objects;
public class InternalValueCount extends InternalNumericMetricsAggregation.SingleValue implements ValueCount { public class InternalValueCount extends InternalNumericMetricsAggregation.SingleValue implements ValueCount {
private final long value; private final long value;
InternalValueCount(String name, long value, List<PipelineAggregator> pipelineAggregators, InternalValueCount(String name, long value, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.value = value; this.value = value;
} }
@ -75,7 +73,7 @@ public class InternalValueCount extends InternalNumericMetricsAggregation.Single
for (InternalAggregation aggregation : aggregations) { for (InternalAggregation aggregation : aggregations) {
valueCount += ((InternalValueCount) aggregation).value; valueCount += ((InternalValueCount) aggregation).value;
} }
return new InternalValueCount(name, valueCount, pipelineAggregators(), getMetadata()); return new InternalValueCount(name, valueCount, getMetadata());
} }
@Override @Override

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -34,9 +33,8 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl
private final double sum; private final double sum;
private final double weight; private final double weight;
InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, List<PipelineAggregator> pipelineAggregators, InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.sum = sum; this.sum = sum;
this.weight = weight; this.weight = weight;
this.format = format; this.format = format;
@ -99,8 +97,7 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl
sumCompensation.add(avg.sum); sumCompensation.add(avg.sum);
} }
return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(), return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(), format, getMetadata());
format, pipelineAggregators(), getMetadata());
} }
@Override @Override

View File

@ -146,12 +146,12 @@ class MaxAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSource == null || bucket >= maxes.size()) { if (valuesSource == null || bucket >= maxes.size()) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
return new InternalMax(name, maxes.get(bucket), formatter, pipelineAggregators(), metadata()); return new InternalMax(name, maxes.get(bucket), formatter, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, pipelineAggregators(), metadata()); return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, metadata());
} }
@Override @Override

View File

@ -126,7 +126,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator.
public InternalAggregation buildAggregation(long bucket) throws IOException { public InternalAggregation buildAggregation(long bucket) throws IOException {
if (hasDataForBucket(bucket)) { if (hasDataForBucket(bucket)) {
final TDigestState valueSketch = valueSketches.get(bucket); final TDigestState valueSketch = valueSketches.get(bucket);
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, valueSketch); return new InternalMedianAbsoluteDeviation(name, metadata(), format, valueSketch);
} else { } else {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
@ -134,7 +134,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator.
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, new TDigestState(compression)); return new InternalMedianAbsoluteDeviation(name, metadata(), format, new TDigestState(compression));
} }
@Override @Override

View File

@ -149,12 +149,12 @@ class MinAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSource == null || bucket >= mins.size()) { if (valuesSource == null || bucket >= mins.size()) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
return new InternalMin(name, mins.get(bucket), format, pipelineAggregators(), metadata()); return new InternalMin(name, mins.get(bucket), format, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalMin(name, Double.POSITIVE_INFINITY, format, pipelineAggregators(), metadata()); return new InternalMin(name, Double.POSITIVE_INFINITY, format, metadata());
} }
@Override @Override

View File

@ -164,12 +164,12 @@ class StatsAggregator extends NumericMetricsAggregator.MultiValue {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
return new InternalStats(name, counts.get(bucket), sums.get(bucket), mins.get(bucket), 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 @Override
public InternalAggregation buildEmptyAggregation() { 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 @Override

View File

@ -109,12 +109,12 @@ class SumAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSource == null || bucket >= sums.size()) { if (valuesSource == null || bucket >= sums.size()) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
return new InternalSum(name, sums.get(bucket), format, pipelineAggregators(), metadata()); return new InternalSum(name, sums.get(bucket), format, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalSum(name, 0.0, format, pipelineAggregators(), metadata()); return new InternalSum(name, 0.0, format, metadata());
} }
@Override @Override

View File

@ -90,12 +90,12 @@ class ValueCountAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSource == null || bucket >= counts.size()) { if (valuesSource == null || bucket >= counts.size()) {
return buildEmptyAggregation(); return buildEmptyAggregation();
} }
return new InternalValueCount(name, counts.get(bucket), pipelineAggregators(), metadata()); return new InternalValueCount(name, counts.get(bucket), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalValueCount(name, 0L, pipelineAggregators(), metadata()); return new InternalValueCount(name, 0L, metadata());
} }
@Override @Override

View File

@ -140,12 +140,12 @@ class WeightedAvgAggregator extends NumericMetricsAggregator.SingleValue {
if (valuesSources == null || bucket >= valueSums.size()) { if (valuesSources == null || bucket >= valueSums.size()) {
return buildEmptyAggregation(); 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 @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalWeightedAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata()); return new InternalWeightedAvg(name, 0.0, 0L, format, metadata());
} }
@Override @Override

View File

@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator { public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
@ -62,9 +61,9 @@ public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
double avgValue = count == 0 ? Double.NaN : (sum / count); double avgValue = count == 0 ? Double.NaN : (sum / count);
return new InternalSimpleValue(name(), avgValue, format, pipelineAggregators, metadata); return new InternalSimpleValue(name(), avgValue, format, metadata);
} }
} }

View File

@ -27,14 +27,10 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregation.ReduceContext; import org.elasticsearch.search.aggregations.InternalAggregation.ReduceContext;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; 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.BucketHelpers.GapPolicy;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.pipeline.SiblingPipelineAggregator;
import org.elasticsearch.search.aggregations.support.AggregationPath; import org.elasticsearch.search.aggregations.support.AggregationPath;
import java.io.IOException; import java.io.IOException;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; 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 * Called after a collection run is finished to build the aggregation for
* the collected state. * the collected state.
* *
* @param pipelineAggregators
* the pipeline aggregators to add to the resulting aggregation
* @param metadata * @param metadata
* the metadata to add to the resulting aggregation * the metadata to add to the resulting aggregation
*/ */
protected abstract InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata); protected abstract InternalAggregation buildAggregation(Map<String, Object> metadata);
/** /**
* Called for each bucket with a value so the state can be modified based on * Called for each bucket with a value so the state can be modified based on

View File

@ -115,8 +115,7 @@ public class BucketScriptPipelineAggregator extends PipelineAggregator {
final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map( final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map(
(p) -> (InternalAggregation) p).collect(Collectors.toList()); (p) -> (InternalAggregation) p).collect(Collectors.toList());
InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(), InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(), formatter, metadata());
formatter, new ArrayList<>(), metadata());
aggs.add(simpleValue); aggs.add(simpleValue);
InternalMultiBucketAggregation.InternalBucket newBucket = originalAgg.createBucket(new InternalAggregations(aggs), InternalMultiBucketAggregation.InternalBucket newBucket = originalAgg.createBucket(new InternalAggregations(aggs),
bucket); bucket);

View File

@ -86,7 +86,7 @@ public class CumulativeSumPipelineAggregator extends PipelineAggregator {
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
.map((p) -> (InternalAggregation) p) .map((p) -> (InternalAggregation) p)
.collect(Collectors.toList()); .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)); Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
newBuckets.add(newBucket); newBuckets.add(newBucket);
} }

View File

@ -97,7 +97,7 @@ public class DerivativePipelineAggregator extends PipelineAggregator {
final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map((p) -> { final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map((p) -> {
return (InternalAggregation) p; return (InternalAggregation) p;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, new ArrayList<PipelineAggregator>(), metadata())); aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, metadata()));
Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs)); Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
newBuckets.add(newBucket); newBuckets.add(newBucket);
} else { } else {

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator { public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
@ -80,7 +79,7 @@ public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipeline
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, pipelineAggregators, metadata); return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, metadata);
} }
} }

View File

@ -40,9 +40,8 @@ public class InternalBucketMetricValue extends InternalNumericMetricsAggregation
private double value; private double value;
private String[] keys; private String[] keys;
public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter, public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.keys = keys; this.keys = keys;
this.value = value; this.value = value;
this.format = formatter; this.format = formatter;

View File

@ -32,9 +32,8 @@ import java.util.Objects;
public class InternalDerivative extends InternalSimpleValue implements Derivative { public class InternalDerivative extends InternalSimpleValue implements Derivative {
private final double normalizationFactor; private final double normalizationFactor;
InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter, InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, value, formatter, metadata);
super(name, value, formatter, pipelineAggregators, metadata);
this.normalizationFactor = normalizationFactor; this.normalizationFactor = normalizationFactor;
} }

View File

@ -30,9 +30,8 @@ import java.util.Map;
public class InternalExtendedStatsBucket extends InternalExtendedStats implements ExtendedStatsBucket { public class InternalExtendedStatsBucket extends InternalExtendedStats implements ExtendedStatsBucket {
InternalExtendedStatsBucket(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma, InternalExtendedStatsBucket(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma,
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, DocValueFormat formatter, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, metadata);
super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, pipelineAggregators, metadata);
} }
/** /**

View File

@ -44,9 +44,8 @@ public class InternalPercentilesBucket extends InternalNumericMetricsAggregation
private final transient Map<Double, Double> percentileLookups = new HashMap<>(); private final transient Map<Double, Double> percentileLookups = new HashMap<>();
InternalPercentilesBucket(String name, double[] percents, double[] percentiles, boolean keyed, InternalPercentilesBucket(String name, double[] percents, double[] percentiles, boolean keyed,
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, DocValueFormat formatter, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
if ((percentiles.length == percents.length) == false) { if ((percentiles.length == percents.length) == false) {
throw new IllegalArgumentException("The number of provided percents and percentiles didn't match. percents: " throw new IllegalArgumentException("The number of provided percents and percentiles didn't match. percents: "
+ Arrays.toString(percents) + ", percentiles: " + Arrays.toString(percentiles)); + Arrays.toString(percents) + ", percentiles: " + Arrays.toString(percentiles));

View File

@ -35,9 +35,8 @@ public class InternalSimpleValue extends InternalNumericMetricsAggregation.Singl
public static final String NAME = "simple_value"; public static final String NAME = "simple_value";
protected final double value; protected final double value;
InternalSimpleValue(String name, double value, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, InternalSimpleValue(String name, double value, DocValueFormat formatter, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.format = formatter; this.format = formatter;
this.value = value; this.value = value;
} }

View File

@ -30,8 +30,8 @@ import java.util.Map;
public class InternalStatsBucket extends InternalStats implements StatsBucket { public class InternalStatsBucket extends InternalStats implements StatsBucket {
public InternalStatsBucket(String name, long count, double sum, double min, double max, DocValueFormat formatter, public InternalStatsBucket(String name, long count, double sum, double min, double max, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, count, sum, min, max, formatter, pipelineAggregators, metadata); super(name, count, sum, min, max, formatter, metadata);
} }
/** /**

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -69,9 +68,9 @@ public class MaxBucketPipelineAggregator extends BucketMetricsPipelineAggregator
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
String[] keys = maxBucketKeys.toArray(new String[maxBucketKeys.size()]); 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());
} }
} }

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -69,9 +68,9 @@ public class MinBucketPipelineAggregator extends BucketMetricsPipelineAggregator
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
String[] keys = minBucketKeys.toArray(new String[0]); 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());
} }
} }

View File

@ -126,7 +126,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator {
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false) List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
.map((p) -> (InternalAggregation) p) .map((p) -> (InternalAggregation) p)
.collect(Collectors.toList()); .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)); 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) aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
.map((p) -> (InternalAggregation) p) .map((p) -> (InternalAggregation) p)
.collect(Collectors.toList()); .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)); Bucket newBucket = factory.createBucket(newKey, bucket.getDocCount(), new InternalAggregations(aggs));
@ -166,7 +166,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator {
} else { } else {
// Not seen before, create fresh // Not seen before, create fresh
aggs = new ArrayList<>(); 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)); Bucket newBucket = factory.createBucket(newKey, 0, new InternalAggregations(aggs));

View File

@ -156,7 +156,7 @@ public class MovFnPipelineAggregator extends PipelineAggregator {
.stream(bucket.getAggregations().spliterator(), false) .stream(bucket.getAggregations().spliterator(), false)
.map(InternalAggregation.class::cast) .map(InternalAggregation.class::cast)
.collect(Collectors.toList()); .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)); newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
index++; index++;
} }

View File

@ -82,8 +82,7 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
// Perform the sorting and percentile collection now that all the data // Perform the sorting and percentile collection now that all the data
// has been collected. // has been collected.
Collections.sort(data); Collections.sort(data);
@ -102,6 +101,6 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg
// todo need postCollection() to clean up temp sorted data? // 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);
} }
} }

View File

@ -113,7 +113,7 @@ public class SerialDiffPipelineAggregator extends PipelineAggregator {
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map( List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map(
(p) -> (InternalAggregation) p).collect(Collectors.toList()); (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)); newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
} }

View File

@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator { public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
@ -65,7 +64,7 @@ public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregat
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
return new InternalStatsBucket(name(), count, sum, min, max, format, pipelineAggregators, metadata); return new InternalStatsBucket(name(), count, sum, min, max, format, metadata);
} }
} }

View File

@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy; import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator { public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
@ -59,8 +58,8 @@ public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator
} }
@Override @Override
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
return new InternalSimpleValue(name(), sum, format, pipelineAggregators, metadata); return new InternalSimpleValue(name(), sum, format, metadata);
} }
} }

View File

@ -78,6 +78,8 @@ import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.Stream; 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.elasticsearch.action.search.SearchProgressListener.NOOP;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo; 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)); 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), result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
new DocValueFormat[0]); new DocValueFormat[0]);
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW, InternalAggregations aggs = new InternalAggregations(singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW, emptyMap())));
Collections.emptyList(), Collections.emptyMap())));
result.aggregations(aggs); result.aggregations(aggs);
result.setShardIndex(0); result.setShardIndex(0);
consumer.consumeResult(result); consumer.consumeResult(result);
@ -394,8 +395,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE)); 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), result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
new DocValueFormat[0]); new DocValueFormat[0]);
aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW, aggs = new InternalAggregations(singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW, emptyMap())));
Collections.emptyList(), Collections.emptyMap())));
result.aggregations(aggs); result.aggregations(aggs);
result.setShardIndex(2); result.setShardIndex(2);
consumer.consumeResult(result); consumer.consumeResult(result);
@ -404,8 +404,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE)); 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), result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
new DocValueFormat[0]); new DocValueFormat[0]);
aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW, aggs = new InternalAggregations(singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW, emptyMap())));
Collections.emptyList(), Collections.emptyMap())));
result.aggregations(aggs); result.aggregations(aggs);
result.setShardIndex(1); result.setShardIndex(1);
consumer.consumeResult(result); 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 TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[] {new ScoreDoc(0, number)}), number),
new DocValueFormat[0]); new DocValueFormat[0]);
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, 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.aggregations(aggs);
result.setShardIndex(id); result.setShardIndex(id);
result.size(1); 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), result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), number),
new DocValueFormat[0]); new DocValueFormat[0]);
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, 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.aggregations(aggs);
result.setShardIndex(i); result.setShardIndex(i);
result.size(1); result.size(1);
@ -868,8 +867,8 @@ public class SearchPhaseControllerTests extends ESTestCase {
result.topDocs(new TopDocsAndMaxScore( result.topDocs(new TopDocsAndMaxScore(
new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[]{new ScoreDoc(0, number)}), number), new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[]{new ScoreDoc(0, number)}), number),
new DocValueFormat[0]); new DocValueFormat[0]);
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number, InternalAggregations aggs = new InternalAggregations(Collections.singletonList(
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap()))); new InternalMax("test", (double) number, DocValueFormat.RAW, Collections.emptyMap())));
result.aggregations(aggs); result.aggregations(aggs);
result.setShardIndex(id); result.setShardIndex(id);
result.size(1); result.size(1);

View File

@ -63,6 +63,8 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; 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.elasticsearch.test.InternalAggregationTestCase.emptyReduceContextBuilder;
import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.Matchers.greaterThan;
@ -361,14 +363,13 @@ public class SearchResponseMergerTests extends ESTestCase {
for (int i = 0; i < numResponses; i++) { for (int i = 0; i < numResponses; i++) {
double value = randomDouble(); double value = randomDouble();
maxValue = Math.max(value, maxValue); 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(); InternalDateRange.Factory factory = new InternalDateRange.Factory();
int count = randomIntBetween(1, 1000); int count = randomIntBetween(1, 1000);
totalCount += count; totalCount += count;
InternalDateRange.Bucket bucket = factory.createBucket("bucket", 0, 10000, count, InternalAggregations.EMPTY, InternalDateRange.Bucket bucket = factory.createBucket("bucket", 0, 10000, count, InternalAggregations.EMPTY,
false, DocValueFormat.RAW); false, DocValueFormat.RAW);
InternalDateRange range = factory.create(rangeAggName, Collections.singletonList(bucket), DocValueFormat.RAW, false, InternalDateRange range = factory.create(rangeAggName, singletonList(bucket), DocValueFormat.RAW, false, emptyMap());
Collections.emptyList(), Collections.emptyMap());
InternalAggregations aggs = new InternalAggregations(Arrays.asList(range, max)); InternalAggregations aggs = new InternalAggregations(Arrays.asList(range, max));
SearchHits searchHits = new SearchHits(new SearchHit[0], null, Float.NaN); SearchHits searchHits = new SearchHits(new SearchHit[0], null, Float.NaN);
InternalSearchResponse internalSearchResponse = new InternalSearchResponse(searchHits, aggs, null, null, false, null, 1); InternalSearchResponse internalSearchResponse = new InternalSearchResponse(searchHits, aggs, null, null, false, null, 1);

View File

@ -62,7 +62,7 @@ public class InternalAggregationsTests extends ESTestCase {
public void testNonFinalReduceTopLevelPipelineAggs() { public void testNonFinalReduceTopLevelPipelineAggs() {
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), 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<InternalAggregations> aggs = singletonList(new InternalAggregations(Collections.singletonList(terms))); List<InternalAggregations> aggs = singletonList(new InternalAggregations(Collections.singletonList(terms)));
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(aggs, maxBucketReduceContext().forPartialReduction()); InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(aggs, maxBucketReduceContext().forPartialReduction());
assertEquals(1, reducedAggs.getTopLevelPipelineAggregators().size()); assertEquals(1, reducedAggs.getTopLevelPipelineAggregators().size());
@ -71,7 +71,7 @@ public class InternalAggregationsTests extends ESTestCase {
public void testFinalReduceTopLevelPipelineAggs() { public void testFinalReduceTopLevelPipelineAggs() {
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true), 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 aggs = new InternalAggregations(Collections.singletonList(terms));
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(Collections.singletonList(aggs), InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(Collections.singletonList(aggs),

View File

@ -41,8 +41,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
public void testResolveToAgg() { public void testResolveToAgg() {
AggregationPath path = AggregationPath.parse("the_avg"); AggregationPath path = AggregationPath.parse("the_avg");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToAggValue() {
AggregationPath path = AggregationPath.parse("the_avg.value"); AggregationPath path = AggregationPath.parse("the_avg.value");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToNothing() {
AggregationPath path = AggregationPath.parse("foo.value"); AggregationPath path = AggregationPath.parse("foo.value");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToUnknown() {
AggregationPath path = AggregationPath.parse("the_avg.unknown"); AggregationPath path = AggregationPath.parse("the_avg.unknown");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToBucketCount() {
AggregationPath path = AggregationPath.parse("_bucket_count"); AggregationPath path = AggregationPath.parse("_bucket_count");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToCount() {
AggregationPath path = AggregationPath.parse("_count"); AggregationPath path = AggregationPath.parse("_count");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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() { public void testResolveToKey() {
AggregationPath path = AggregationPath.parse("_key"); AggregationPath path = AggregationPath.parse("_key");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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"); AggregationPath path = AggregationPath.parse("string_terms['foo']>the_avg.value");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg));
List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket( List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket(
new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1, new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1,
internalStringAggs, false, 0, DocValueFormat.RAW)); 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); Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0);
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg));
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); 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"); AggregationPath path = AggregationPath.parse("string_terms['bar']>the_avg.value");
List<LongTerms.Bucket> buckets = new ArrayList<>(); List<LongTerms.Bucket> buckets = new ArrayList<>();
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg)); InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg));
List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket( List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket(
new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1, new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1,
internalStringAggs, false, 0, DocValueFormat.RAW)); 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); Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0);
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg)); InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg));
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW); LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW);

View File

@ -31,6 +31,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import static java.util.Collections.emptyList;
public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregationTestCase<InternalAdjacencyMatrix> { public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregationTestCase<InternalAdjacencyMatrix> {
private List<String> keys; private List<String> keys;
@ -66,15 +68,14 @@ public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregation
} }
@Override @Override
protected InternalAdjacencyMatrix createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, protected InternalAdjacencyMatrix createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
Map<String, Object> metadata, InternalAggregations aggregations) {
final List<InternalAdjacencyMatrix.InternalBucket> buckets = new ArrayList<>(); final List<InternalAdjacencyMatrix.InternalBucket> buckets = new ArrayList<>();
for (int i = 0; i < keys.size(); ++i) { for (int i = 0; i < keys.size(); ++i) {
String key = keys.get(i); String key = keys.get(i);
int docCount = randomIntBetween(0, 1000); int docCount = randomIntBetween(0, 1000);
buckets.add(new InternalAdjacencyMatrix.InternalBucket(key, docCount, aggregations)); buckets.add(new InternalAdjacencyMatrix.InternalBucket(key, docCount, aggregations));
} }
return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators, metadata); return new InternalAdjacencyMatrix(name, buckets, emptyList(), metadata);
} }
@Override @Override

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.ParsedAggregation; import org.elasticsearch.search.aggregations.ParsedAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.test.InternalMultiBucketAggregationTestCase; import org.elasticsearch.test.InternalMultiBucketAggregationTestCase;
import org.junit.After; import org.junit.After;
@ -155,8 +154,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
} }
@Override @Override
protected InternalComposite createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, protected InternalComposite createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
Map<String, Object> metadata, InternalAggregations aggregations) {
int numBuckets = randomIntBetween(0, size); int numBuckets = randomIntBetween(0, size);
List<InternalComposite.InternalBucket> buckets = new ArrayList<>(); List<InternalComposite.InternalBucket> buckets = new ArrayList<>();
TreeSet<CompositeKey> keys = new TreeSet<>(getKeyComparator()); TreeSet<CompositeKey> keys = new TreeSet<>(getKeyComparator());
@ -233,7 +231,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
} }
public void testReduceSame() throws IOException { public void testReduceSame() throws IOException {
InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyList(), Collections.emptyMap(), InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyMap(),
InternalAggregations.EMPTY); InternalAggregations.EMPTY);
List<InternalAggregation> toReduce = new ArrayList<>(); List<InternalAggregation> toReduce = new ArrayList<>();
int numSame = randomIntBetween(1, 10); int numSame = randomIntBetween(1, 10);
@ -254,7 +252,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
* Check that reducing with an unmapped index produces useful formats. * Check that reducing with an unmapped index produces useful formats.
*/ */
public void testReduceUnmapped() throws IOException { public void testReduceUnmapped() throws IOException {
InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyList(), emptyMap(), InternalAggregations.EMPTY); InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyMap(), InternalAggregations.EMPTY);
List<DocValueFormat> rawFormats = formats.stream().map(f -> DocValueFormat.RAW).collect(toList()); List<DocValueFormat> rawFormats = formats.stream().map(f -> DocValueFormat.RAW).collect(toList());
InternalComposite unmapped = new InternalComposite(mapped.getName(), mapped.getSize(), sourceNames, InternalComposite unmapped = new InternalComposite(mapped.getName(), mapped.getSize(), sourceNames,
rawFormats, emptyList(), null, reverseMuls, true, emptyList(), emptyMap()); rawFormats, emptyList(), null, reverseMuls, true, emptyList(), emptyMap());

View File

@ -21,10 +21,9 @@ package org.elasticsearch.search.aggregations.bucket.filter;
import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.test.InternalMultiBucketAggregationTestCase;
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation; import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilters.InternalBucket; 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.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -54,15 +53,14 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
} }
@Override @Override
protected InternalFilters createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, protected InternalFilters createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
InternalAggregations aggregations) {
final List<InternalFilters.InternalBucket> buckets = new ArrayList<>(); final List<InternalFilters.InternalBucket> buckets = new ArrayList<>();
for (int i = 0; i < keys.size(); ++i) { for (int i = 0; i < keys.size(); ++i) {
String key = keys.get(i); String key = keys.get(i);
int docCount = randomIntBetween(0, 1000); int docCount = randomIntBetween(0, 1000);
buckets.add(new InternalFilters.InternalBucket(key, docCount, aggregations, keyed)); 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 @Override
@ -96,7 +94,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
protected InternalFilters mutateInstance(InternalFilters instance) { protected InternalFilters mutateInstance(InternalFilters instance) {
String name = instance.getName(); String name = instance.getName();
List<InternalBucket> buckets = instance.getBuckets(); List<InternalBucket> buckets = instance.getBuckets();
List<PipelineAggregator> pipelineAggregators = instance.pipelineAggregators();
Map<String, Object> metadata = instance.getMetadata(); Map<String, Object> metadata = instance.getMetadata();
switch (between(0, 2)) { switch (between(0, 2)) {
case 0: case 0:
@ -116,6 +113,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
metadata.put(randomAlphaOfLength(15), randomInt()); metadata.put(randomAlphaOfLength(15), randomInt());
break; break;
} }
return new InternalFilters(name, buckets, keyed, pipelineAggregators, metadata); return new InternalFilters(name, buckets, keyed, metadata);
} }
} }

Some files were not shown because too many files have changed in this diff Show More