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:
parent
547ab849b4
commit
54ea4f4f50
|
@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -43,8 +42,8 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
|
|||
|
||||
/** per shard ctor */
|
||||
InternalMatrixStats(String name, long count, RunningStats multiFieldStatsResults, MatrixStatsResults results,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
assert count >= 0;
|
||||
this.stats = multiFieldStatsResults;
|
||||
this.results = results;
|
||||
|
@ -240,7 +239,7 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
|
|||
|
||||
// return empty result iff all stats are null
|
||||
if (aggs.isEmpty()) {
|
||||
return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), pipelineAggregators(), getMetadata());
|
||||
return new InternalMatrixStats(name, 0, null, new MatrixStatsResults(), getMetadata());
|
||||
}
|
||||
|
||||
RunningStats runningStats = new RunningStats();
|
||||
|
@ -250,9 +249,9 @@ public class InternalMatrixStats extends InternalAggregation implements MatrixSt
|
|||
|
||||
if (reduceContext.isFinalReduce()) {
|
||||
MatrixStatsResults results = new MatrixStatsResults(runningStats);
|
||||
return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, pipelineAggregators(), getMetadata());
|
||||
return new InternalMatrixStats(name, results.getDocCount(), runningStats, results, getMetadata());
|
||||
}
|
||||
return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, pipelineAggregators(), getMetadata());
|
||||
return new InternalMatrixStats(name, runningStats.docCount, runningStats, null, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -126,12 +126,12 @@ final class MatrixStatsAggregator extends MetricsAggregator {
|
|||
if (valuesSources == null || bucket >= stats.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, pipelineAggregators(), metadata());
|
||||
return new InternalMatrixStats(name, stats.size(), stats.get(bucket), null, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalMatrixStats(name, 0, null, null, pipelineAggregators(), metadata());
|
||||
return new InternalMatrixStats(name, 0, null, null, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.Aggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.ParsedAggregation;
|
||||
import org.elasticsearch.search.aggregations.matrix.stats.InternalMatrixStats.Fields;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree;
|
||||
import org.elasticsearch.test.InternalAggregationTestCase;
|
||||
|
||||
|
@ -69,8 +68,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalMatrixStats createTestInstance(String name, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
protected InternalMatrixStats createTestInstance(String name, Map<String, Object> metadata) {
|
||||
double[] values = new double[fields.length];
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
values[i] = randomDouble();
|
||||
|
@ -79,7 +77,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
|
|||
RunningStats runningStats = new RunningStats();
|
||||
runningStats.add(fields, values);
|
||||
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
|
||||
|
@ -125,7 +123,7 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
|
|||
metadata.put(randomAlphaOfLength(15), randomInt());
|
||||
break;
|
||||
}
|
||||
return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, Collections.emptyList(), metadata);
|
||||
return new InternalMatrixStats(name, docCount, runningStats, matrixStatsResults, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,14 +147,14 @@ public class InternalMatrixStatsTests extends InternalAggregationTestCase<Intern
|
|||
|
||||
runningStats.add(new String[]{"a", "b"}, new double[]{valueA, valueB});
|
||||
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();
|
||||
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.computeStats(aValues, bValues);
|
||||
|
|
|
@ -155,6 +155,19 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
*
|
||||
* @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) {
|
||||
this.name = name;
|
||||
this.pipelineAggregators = pipelineAggregators;
|
||||
|
@ -171,6 +184,7 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
forEachBucket(bucketAggs -> bucketAggs.mergePipelineTreeForBWCSerialization(pipelineTree));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Read from a stream.
|
||||
*/
|
||||
|
|
|
@ -37,6 +37,14 @@ public abstract class InternalMultiBucketAggregation<A extends InternalMultiBuck
|
|||
B extends InternalMultiBucketAggregation.InternalBucket>
|
||||
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) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
}
|
||||
|
|
|
@ -181,7 +181,7 @@ public class FiltersAggregator extends BucketsAggregator {
|
|||
bucketAggregations(bucketOrd), keyed);
|
||||
buckets.add(bucket);
|
||||
}
|
||||
return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metadata());
|
||||
return new InternalFilters(name, buckets, keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -198,7 +198,7 @@ public class FiltersAggregator extends BucketsAggregator {
|
|||
buckets.add(bucket);
|
||||
}
|
||||
|
||||
return new InternalFilters(name, buckets, keyed, pipelineAggregators(), metadata());
|
||||
return new InternalFilters(name, buckets, keyed, metadata());
|
||||
}
|
||||
|
||||
final long bucketOrd(long owningBucketOrdinal, int filterOrd) {
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -126,9 +125,8 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
// bucketMap gets lazily initialized from buckets in getBucketByKey()
|
||||
private transient Map<String, InternalBucket> bucketMap;
|
||||
|
||||
public InternalFilters(String name, List<InternalBucket> buckets, boolean keyed, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalFilters(String name, List<InternalBucket> buckets, boolean keyed, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.buckets = buckets;
|
||||
this.keyed = keyed;
|
||||
}
|
||||
|
@ -164,7 +162,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -209,8 +207,7 @@ public class InternalFilters extends InternalMultiBucketAggregation<InternalFilt
|
|||
}
|
||||
|
||||
reduceContext.consumeBucketsAndMaybeBreak(bucketsList.size());
|
||||
InternalFilters reduced = new InternalFilters(name, new ArrayList<>(bucketsList.size()), keyed, pipelineAggregators(),
|
||||
getMetadata());
|
||||
InternalFilters reduced = new InternalFilters(name, new ArrayList<>(bucketsList.size()), keyed, getMetadata());
|
||||
for (List<InternalBucket> sameRangeList : bucketsList) {
|
||||
reduced.buckets.add(reduceBucket(sameRangeList, reduceContext));
|
||||
}
|
||||
|
|
|
@ -95,8 +95,7 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends Bucke
|
|||
};
|
||||
}
|
||||
|
||||
abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
|
||||
abstract T buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
|
||||
|
||||
/**
|
||||
* 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);
|
||||
list[i] = bucket;
|
||||
}
|
||||
return buildAggregation(name, requiredSize, Arrays.asList(list), pipelineAggregators(), metadata());
|
||||
return buildAggregation(name, requiredSize, Arrays.asList(list), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalGeoGrid buildEmptyAggregation() {
|
||||
return buildAggregation(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata());
|
||||
return buildAggregation(name, requiredSize, Collections.emptyList(), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,13 +43,13 @@ public class GeoHashGridAggregator extends GeoGridAggregator<InternalGeoHashGrid
|
|||
|
||||
@Override
|
||||
InternalGeoHashGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalGeoHashGrid buildEmptyAggregation() {
|
||||
return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata());
|
||||
return new InternalGeoHashGrid(name, requiredSize, Collections.emptyList(), metadata());
|
||||
}
|
||||
|
||||
InternalGeoGridBucket newEmptyBucket() {
|
||||
|
|
|
@ -34,10 +34,11 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
|||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> {
|
||||
|
||||
private final int precision;
|
||||
|
@ -61,8 +62,7 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize,
|
||||
Collections.emptyList(), pipelineAggregators, metadata);
|
||||
final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, emptyList(), metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
|
|
|
@ -44,13 +44,13 @@ public class GeoTileGridAggregator extends GeoGridAggregator<InternalGeoTileGrid
|
|||
|
||||
@Override
|
||||
InternalGeoTileGrid buildAggregation(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalGeoTileGrid buildEmptyAggregation() {
|
||||
return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), pipelineAggregators(), metadata());
|
||||
return new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata());
|
||||
}
|
||||
|
||||
InternalGeoGridBucket newEmptyBucket() {
|
||||
|
|
|
@ -60,8 +60,7 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize,
|
||||
Collections.emptyList(), pipelineAggregators, metadata);
|
||||
final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -48,9 +47,8 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
|
|||
protected final int requiredSize;
|
||||
protected final List<InternalGeoGridBucket> buckets;
|
||||
|
||||
InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalGeoGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.requiredSize = requiredSize;
|
||||
this.buckets = buckets;
|
||||
}
|
||||
|
@ -72,8 +70,7 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
|
|||
out.writeList(buckets);
|
||||
}
|
||||
|
||||
abstract InternalGeoGrid create(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
|
||||
abstract InternalGeoGrid create(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata);
|
||||
|
||||
@Override
|
||||
public List<InternalGeoGridBucket> getBuckets() {
|
||||
|
@ -115,7 +112,7 @@ public abstract class InternalGeoGrid<B extends InternalGeoGridBucket>
|
|||
for (int i = ordered.size() - 1; i >= 0; i--) {
|
||||
list[i] = ordered.pop();
|
||||
}
|
||||
return create(getName(), requiredSize, Arrays.asList(list), pipelineAggregators(), getMetadata());
|
||||
return create(getName(), requiredSize, Arrays.asList(list), getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
|
|||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBucket> {
|
||||
|
||||
InternalGeoHashGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, requiredSize, buckets, pipelineAggregators, metadata);
|
||||
InternalGeoHashGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
|
||||
super(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
public InternalGeoHashGrid(StreamInput in) throws IOException {
|
||||
|
@ -44,7 +42,7 @@ public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBuck
|
|||
|
||||
@Override
|
||||
public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) {
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, pipelineAggregators(), metadata);
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +51,8 @@ public class InternalGeoHashGrid extends InternalGeoGrid<InternalGeoHashGridBuck
|
|||
}
|
||||
|
||||
@Override
|
||||
InternalGeoGrid create(String name, int requiredSize, List buckets, List list, Map metadata) {
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, list, metadata);
|
||||
InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata) {
|
||||
return new InternalGeoHashGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
|
|||
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,8 @@ import java.util.Map;
|
|||
*/
|
||||
public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBucket> {
|
||||
|
||||
InternalGeoTileGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, requiredSize, buckets, pipelineAggregators, metadata);
|
||||
InternalGeoTileGrid(String name, int requiredSize, List<InternalGeoGridBucket> buckets, Map<String, Object> metadata) {
|
||||
super(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
public InternalGeoTileGrid(StreamInput in) throws IOException {
|
||||
|
@ -44,7 +42,7 @@ public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBuck
|
|||
|
||||
@Override
|
||||
public InternalGeoGrid create(List<InternalGeoGridBucket> buckets) {
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, pipelineAggregators(), metadata);
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,8 +51,8 @@ public class InternalGeoTileGrid extends InternalGeoGrid<InternalGeoTileGridBuck
|
|||
}
|
||||
|
||||
@Override
|
||||
InternalGeoGrid create(String name, int requiredSize, List buckets, List list, Map metadata) {
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, list, metadata);
|
||||
InternalGeoGrid create(String name, int requiredSize, List buckets, Map metadata) {
|
||||
return new InternalGeoTileGrid(name, requiredSize, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -148,8 +148,8 @@ class DateHistogramAggregator extends BucketsAggregator {
|
|||
InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0
|
||||
? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds)
|
||||
: null;
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, keyed,
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
|
||||
keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -158,7 +158,7 @@ class DateHistogramAggregator extends BucketsAggregator {
|
|||
? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds)
|
||||
: null;
|
||||
return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
|
||||
keyed, pipelineAggregators(), metadata());
|
||||
keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -169,8 +169,8 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
|
|||
InternalDateHistogram.EmptyBucketInfo emptyBucketInfo = minDocCount == 0
|
||||
? new InternalDateHistogram.EmptyBucketInfo(rounding.withoutOffset(), buildEmptySubAggregations(), extendedBounds)
|
||||
: null;
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter, keyed,
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
|
||||
keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -179,7 +179,7 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
|
|||
? new InternalDateHistogram.EmptyBucketInfo(rounding, buildEmptySubAggregations(), extendedBounds)
|
||||
: null;
|
||||
return new InternalDateHistogram(name, Collections.emptyList(), order, minDocCount, rounding.offset(), emptyBucketInfo, formatter,
|
||||
keyed, pipelineAggregators(), metadata());
|
||||
keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
|
@ -211,10 +210,8 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
|
|||
final EmptyBucketInfo emptyBucketInfo;
|
||||
|
||||
InternalDateHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, long offset,
|
||||
EmptyBucketInfo emptyBucketInfo,
|
||||
DocValueFormat formatter, boolean keyed, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
EmptyBucketInfo emptyBucketInfo, DocValueFormat formatter, boolean keyed, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.buckets = buckets;
|
||||
this.order = order;
|
||||
this.offset = offset;
|
||||
|
@ -284,8 +281,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
|
|||
|
||||
@Override
|
||||
public InternalDateHistogram create(List<Bucket> buckets) {
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format,
|
||||
keyed, pipelineAggregators(), metadata);
|
||||
return new InternalDateHistogram(name, buckets, order, minDocCount, offset, emptyBucketInfo, format, keyed, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -467,7 +463,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
|
|||
}
|
||||
}
|
||||
return new InternalDateHistogram(getName(), reducedBuckets, order, minDocCount, offset, emptyBucketInfo,
|
||||
format, keyed, pipelineAggregators(), getMetadata());
|
||||
format, keyed, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -508,8 +504,7 @@ public final class InternalDateHistogram extends InternalMultiBucketAggregation<
|
|||
buckets2.add((Bucket) b);
|
||||
}
|
||||
buckets2 = Collections.unmodifiableList(buckets2);
|
||||
return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format,
|
||||
keyed, pipelineAggregators(), getMetadata());
|
||||
return new InternalDateHistogram(name, buckets2, order, minDocCount, offset, emptyBucketInfo, format, keyed, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -205,9 +204,8 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
|
|||
final EmptyBucketInfo emptyBucketInfo;
|
||||
|
||||
InternalHistogram(String name, List<Bucket> buckets, BucketOrder order, long minDocCount, EmptyBucketInfo emptyBucketInfo,
|
||||
DocValueFormat formatter, boolean keyed, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
DocValueFormat formatter, boolean keyed, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.buckets = buckets;
|
||||
this.order = order;
|
||||
assert (minDocCount == 0) == (emptyBucketInfo != null);
|
||||
|
@ -266,7 +264,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -439,8 +437,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
|
|||
CollectionUtil.introSort(reducedBuckets, order.comparator());
|
||||
}
|
||||
}
|
||||
return new InternalHistogram(getName(), reducedBuckets, order, minDocCount, emptyBucketInfo, format, keyed, pipelineAggregators(),
|
||||
getMetadata());
|
||||
return new InternalHistogram(getName(), reducedBuckets, order, minDocCount, emptyBucketInfo, format, keyed, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -481,8 +478,7 @@ public final class InternalHistogram extends InternalMultiBucketAggregation<Inte
|
|||
buckets2.add((Bucket) b);
|
||||
}
|
||||
buckets2 = Collections.unmodifiableList(buckets2);
|
||||
return new InternalHistogram(name, buckets2, order, minDocCount, emptyBucketInfo, format,
|
||||
keyed, pipelineAggregators(), getMetadata());
|
||||
return new InternalHistogram(name, buckets2, order, minDocCount, emptyBucketInfo, format, keyed, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -150,8 +150,7 @@ class NumericHistogramAggregator extends BucketsAggregator {
|
|||
if (minDocCount == 0) {
|
||||
emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
|
||||
}
|
||||
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -160,8 +159,7 @@ class NumericHistogramAggregator extends BucketsAggregator {
|
|||
if (minDocCount == 0) {
|
||||
emptyBucketInfo = new EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
|
||||
}
|
||||
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed,
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -154,8 +154,7 @@ public class RangeHistogramAggregator extends BucketsAggregator {
|
|||
if (minDocCount == 0) {
|
||||
emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
|
||||
}
|
||||
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalHistogram(name, buckets, order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,8 +163,7 @@ public class RangeHistogramAggregator extends BucketsAggregator {
|
|||
if (minDocCount == 0) {
|
||||
emptyBucketInfo = new InternalHistogram.EmptyBucketInfo(interval, offset, minBound, maxBound, buildEmptySubAggregations());
|
||||
}
|
||||
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed,
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalHistogram(name, Collections.emptyList(), order, minDocCount, emptyBucketInfo, formatter, keyed, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -88,14 +87,14 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
|
|||
|
||||
@Override
|
||||
public InternalDateRange create(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalDateRange(name, ranges, formatter, keyed, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalDateRange(name, ranges, formatter, keyed, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalDateRange create(List<Bucket> ranges, InternalDateRange prototype) {
|
||||
return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(),
|
||||
prototype.metadata);
|
||||
return new InternalDateRange(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -112,8 +111,8 @@ public class InternalDateRange extends InternalRange<InternalDateRange.Bucket, I
|
|||
}
|
||||
|
||||
InternalDateRange(String name, List<InternalDateRange.Bucket> ranges, DocValueFormat formatter, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, ranges, formatter, keyed, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, ranges, formatter, keyed, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -67,14 +66,13 @@ public class InternalGeoDistance extends InternalRange<InternalGeoDistance.Bucke
|
|||
|
||||
@Override
|
||||
public InternalGeoDistance create(String name, List<Bucket> ranges, DocValueFormat format, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalGeoDistance(name, ranges, keyed, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalGeoDistance(name, ranges, keyed, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalGeoDistance create(List<Bucket> ranges, InternalGeoDistance prototype) {
|
||||
return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.pipelineAggregators(),
|
||||
prototype.metadata);
|
||||
return new InternalGeoDistance(prototype.name, ranges, prototype.keyed, prototype.metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -90,10 +88,8 @@ public class InternalGeoDistance extends InternalRange<InternalGeoDistance.Bucke
|
|||
}
|
||||
}
|
||||
|
||||
public InternalGeoDistance(String name, List<Bucket> ranges, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, ranges, DocValueFormat.RAW, keyed, pipelineAggregators, metadata);
|
||||
public InternalGeoDistance(String name, List<Bucket> ranges, boolean keyed, Map<String, Object> metadata) {
|
||||
super(name, ranges, DocValueFormat.RAW, keyed, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.CoreValuesSourceType;
|
||||
import org.elasticsearch.search.aggregations.support.ValueType;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceType;
|
||||
|
@ -202,9 +201,8 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public R create(String name, List<B> ranges, DocValueFormat format, boolean keyed, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
return (R) new InternalRange<B, R>(name, ranges, format, keyed, pipelineAggregators, metadata);
|
||||
public R create(String name, List<B> ranges, DocValueFormat format, boolean keyed, Map<String, Object> metadata) {
|
||||
return (R) new InternalRange<B, R>(name, ranges, format, keyed, metadata);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -215,8 +213,7 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public R create(List<B> ranges, R prototype) {
|
||||
return (R) new InternalRange<B, R>(prototype.name, ranges, prototype.format, prototype.keyed, prototype.pipelineAggregators(),
|
||||
prototype.metadata);
|
||||
return (R) new InternalRange<B, R>(prototype.name, ranges, prototype.format, prototype.keyed, prototype.metadata);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -230,10 +227,8 @@ public class InternalRange<B extends InternalRange.Bucket, R extends InternalRan
|
|||
protected final DocValueFormat format;
|
||||
protected final boolean keyed;
|
||||
|
||||
public InternalRange(String name, List<B> ranges, DocValueFormat format, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalRange(String name, List<B> ranges, DocValueFormat format, boolean keyed, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.ranges = ranges;
|
||||
this.format = format;
|
||||
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) {
|
||||
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
|
||||
|
|
|
@ -338,7 +338,7 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
buckets.add(bucket);
|
||||
}
|
||||
// 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
|
||||
|
@ -352,7 +352,7 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
buckets.add(bucket);
|
||||
}
|
||||
// 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 {
|
||||
|
@ -380,7 +380,7 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
for (RangeAggregator.Range range : ranges) {
|
||||
buckets.add(factory.createBucket(range.key, range.from, range.to, 0, subAggs, keyed, format));
|
||||
}
|
||||
return factory.create(name, buckets, format, keyed, pipelineAggregators(), metadata());
|
||||
return factory.create(name, buckets, format, keyed, metadata());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
|
|||
}
|
||||
|
||||
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -172,7 +172,7 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
|
|||
IndexReader topReader = searcher.getIndexReader();
|
||||
int supersetSize = topReader.numDocs();
|
||||
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList());
|
||||
metadata(), format, numCollectedDocs, supersetSize, significanceHeuristic, emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -46,10 +45,10 @@ public abstract class InternalMappedSignificantTerms<
|
|||
protected final List<B> buckets;
|
||||
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,
|
||||
SignificanceHeuristic significanceHeuristic, List<B> buckets) {
|
||||
super(name, requiredSize, minDocCount, pipelineAggregators, metadata);
|
||||
super(name, requiredSize, minDocCount, metadata);
|
||||
this.format = format;
|
||||
this.buckets = buckets;
|
||||
this.subsetSize = subsetSize;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -166,9 +165,8 @@ public abstract class InternalSignificantTerms<A extends InternalSignificantTerm
|
|||
protected final int requiredSize;
|
||||
protected final long minDocCount;
|
||||
|
||||
protected InternalSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
protected InternalSignificantTerms(String name, int requiredSize, long minDocCount, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.requiredSize = requiredSize;
|
||||
this.minDocCount = minDocCount;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -101,10 +100,10 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<Signifi
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ public class SignificantLongTerms extends InternalMappedSignificantTerms<Signifi
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
|
|||
}
|
||||
|
||||
return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -131,7 +131,7 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
|
|||
IndexReader topReader = searcher.getIndexReader();
|
||||
int supersetSize = topReader.numDocs();
|
||||
return new SignificantLongTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -106,11 +105,10 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<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,
|
||||
SignificanceHeuristic significanceHeuristic, List<Bucket> buckets) {
|
||||
super(name, requiredSize, minDocCount, pipelineAggregators, metadata, format, subsetSize, supersetSize, significanceHeuristic,
|
||||
buckets);
|
||||
super(name, requiredSize, minDocCount, metadata, format, subsetSize, supersetSize, significanceHeuristic, buckets);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -127,7 +125,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -139,7 +137,7 @@ public class SignificantStringTerms extends InternalMappedSignificantTerms<Signi
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator {
|
|||
}
|
||||
|
||||
return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), pipelineAggregators(),
|
||||
bucketCountThresholds.getMinDocCount(),
|
||||
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator {
|
|||
IndexReader topReader = searcher.getIndexReader();
|
||||
int supersetSize = topReader.numDocs();
|
||||
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -167,7 +167,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), pipelineAggregators, metadata);
|
||||
bucketCountThresholds.getMinDocCount(), metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
|
|
|
@ -232,7 +232,7 @@ public class SignificantTextAggregator extends BucketsAggregator {
|
|||
}
|
||||
|
||||
return new SignificantStringTerms( name, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), pipelineAggregators(),
|
||||
bucketCountThresholds.getMinDocCount(),
|
||||
metadata(), format, subsetSize, supersetSize, significanceHeuristic, Arrays.asList(list));
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ public class SignificantTextAggregator extends BucketsAggregator {
|
|||
IndexReader topReader = searcher.getIndexReader();
|
||||
int supersetSize = topReader.numDocs();
|
||||
return new SignificantStringTerms(name, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
metadata(), format, 0, supersetSize, significanceHeuristic, emptyList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.InternalTerms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.UnmappedTerms;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
|
@ -56,9 +55,8 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
|
|||
}
|
||||
}
|
||||
|
||||
public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, requiredSize, minDocCount, pipelineAggregators, metadata);
|
||||
public UnmappedSignificantTerms(String name, int requiredSize, long minDocCount, Map<String, Object> metadata) {
|
||||
super(name, requiredSize, minDocCount, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,7 +83,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
|
|||
|
||||
@Override
|
||||
public UnmappedSignificantTerms create(List<Bucket> buckets) {
|
||||
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata);
|
||||
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,7 +104,7 @@ public class UnmappedSignificantTerms extends InternalSignificantTerms<UnmappedS
|
|||
|
||||
@Override
|
||||
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
|
||||
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, pipelineAggregators(), metadata);
|
||||
return new UnmappedSignificantTerms(name, requiredSize, minDocCount, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,9 +22,9 @@ package org.elasticsearch.search.aggregations.bucket.terms;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -47,7 +47,7 @@ abstract class AbstractStringTermsAggregator extends TermsAggregator {
|
|||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0);
|
||||
metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -101,10 +100,10 @@ public class DoubleTerms extends InternalMappedTerms<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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ public class DoubleTerms extends InternalMappedTerms<DoubleTerms, DoubleTerms.Bu
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ public class DoubleTermsAggregator extends LongTermsAggregator {
|
|||
|
||||
private static DoubleTerms convertToDouble(LongTerms terms) {
|
||||
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.docCountError);
|
||||
}
|
||||
|
|
|
@ -240,7 +240,7 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
|
|||
}
|
||||
|
||||
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError,
|
||||
metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError,
|
||||
otherDocCount, Arrays.asList(list), 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -47,9 +46,9 @@ public abstract class InternalMappedTerms<A extends InternalTerms<A, B>, B exten
|
|||
protected long docCountError;
|
||||
|
||||
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) {
|
||||
super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata);
|
||||
super(name, order, requiredSize, minDocCount, metadata);
|
||||
this.format = format;
|
||||
this.shardSize = shardSize;
|
||||
this.showTermDocCountError = showTermDocCountError;
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -157,9 +156,8 @@ public abstract class InternalTerms<A extends InternalTerms<A, B>, B extends Int
|
|||
protected final int requiredSize;
|
||||
protected final long minDocCount;
|
||||
|
||||
protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
protected InternalTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.order = order;
|
||||
this.requiredSize = requiredSize;
|
||||
this.minDocCount = minDocCount;
|
||||
|
|
|
@ -22,10 +22,9 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -101,10 +100,10 @@ public class LongTerms extends InternalMappedTerms<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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -122,7 +121,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -134,7 +133,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -170,7 +169,7 @@ public class LongTerms extends InternalMappedTerms<LongTerms, LongTerms.Bucket>
|
|||
longTerms.showTermDocCountError ? bucket.getDocCountError() : 0, decimalFormat));
|
||||
}
|
||||
return new DoubleTerms(longTerms.getName(), longTerms.order, longTerms.requiredSize,
|
||||
longTerms.minDocCount, longTerms.pipelineAggregators(),
|
||||
longTerms.minDocCount,
|
||||
longTerms.metadata, longTerms.format, longTerms.shardSize,
|
||||
longTerms.showTermDocCountError, longTerms.otherDocCount,
|
||||
newBuckets, longTerms.docCountError);
|
||||
|
|
|
@ -26,13 +26,13 @@ import org.elasticsearch.common.util.LongHash;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
|
@ -169,14 +169,14 @@ public class LongTermsAggregator extends TermsAggregator {
|
|||
}
|
||||
|
||||
return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount,
|
||||
metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount,
|
||||
Arrays.asList(list), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new LongTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0);
|
||||
metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, 0, emptyList(), 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,9 +23,8 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -104,10 +103,10 @@ public class StringTerms extends InternalMappedTerms<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,
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -125,7 +124,7 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -142,7 +141,7 @@ public class StringTerms extends InternalMappedTerms<StringTerms, StringTerms.Bu
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator {
|
|||
}
|
||||
|
||||
return new StringTerms(name, order, bucketCountThresholds.getRequiredSize(), bucketCountThresholds.getMinDocCount(),
|
||||
pipelineAggregators(), metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount,
|
||||
metadata(), format, bucketCountThresholds.getShardSize(), showTermDocCountError, otherDocCount,
|
||||
Arrays.asList(list), 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), pipelineAggregators, metadata);
|
||||
bucketCountThresholds.getMinDocCount(), metadata);
|
||||
Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
@ -51,9 +50,8 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
|
|||
}
|
||||
}
|
||||
|
||||
public UnmappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, order, requiredSize, minDocCount, pipelineAggregators, metadata);
|
||||
public UnmappedTerms(String name, BucketOrder order, int requiredSize, long minDocCount, Map<String, Object> metadata) {
|
||||
super(name, order, requiredSize, minDocCount, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,7 +78,7 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
|
|||
|
||||
@Override
|
||||
public UnmappedTerms create(List<Bucket> buckets) {
|
||||
return new UnmappedTerms(name, order, requiredSize, minDocCount, pipelineAggregators(), metadata);
|
||||
return new UnmappedTerms(name, order, requiredSize, minDocCount, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,7 +98,7 @@ public class UnmappedTerms extends InternalTerms<UnmappedTerms, UnmappedTerms.Bu
|
|||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -42,9 +41,8 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
|
|||
protected final boolean keyed;
|
||||
|
||||
AbstractInternalHDRPercentiles(String name, double[] keys, DoubleHistogram state, boolean keyed, DocValueFormat format,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
super(name, metadata);
|
||||
this.keys = keys;
|
||||
this.state = state;
|
||||
this.keyed = keyed;
|
||||
|
@ -113,11 +111,11 @@ abstract class AbstractInternalHDRPercentiles extends InternalNumericMetricsAggr
|
|||
}
|
||||
merged.add(percentiles.state);
|
||||
}
|
||||
return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetadata());
|
||||
return createReduced(getName(), keys, merged, keyed, getMetadata());
|
||||
}
|
||||
|
||||
protected abstract AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
|
||||
Map<String, Object> metadata);
|
||||
|
||||
@Override
|
||||
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
|
||||
|
|
|
@ -117,12 +117,12 @@ class AvgAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSource == null || bucket >= sums.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalAvg(name, sums.get(bucket), counts.get(bucket), format, pipelineAggregators(), metadata());
|
||||
return new InternalAvg(name, sums.get(bucket), counts.get(bucket), format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata());
|
||||
return new InternalAvg(name, 0.0, 0L, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -150,12 +150,12 @@ class CardinalityAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
// this Aggregator (and its HLL++ counters) is released.
|
||||
HyperLogLogPlusPlus copy = new HyperLogLogPlusPlus(precision, BigArrays.NON_RECYCLING_INSTANCE, 1);
|
||||
copy.merge(0, counts, owningBucketOrdinal);
|
||||
return new InternalCardinality(name, copy, pipelineAggregators(), metadata());
|
||||
return new InternalCardinality(name, copy, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalCardinality(name, null, pipelineAggregators(), metadata());
|
||||
return new InternalCardinality(name, null, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -205,13 +205,12 @@ class ExtendedStatsAggregator extends NumericMetricsAggregator.MultiValue {
|
|||
}
|
||||
return new InternalExtendedStats(name, counts.get(bucket), sums.get(bucket),
|
||||
mins.get(bucket), maxes.get(bucket), sumOfSqrs.get(bucket), sigma, format,
|
||||
pipelineAggregators(), metadata());
|
||||
metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d,
|
||||
sigma, format, pipelineAggregators(), metadata());
|
||||
return new InternalExtendedStats(name, 0, 0d, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, 0d, sigma, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ class HDRPercentileRanksAggregator extends AbstractHDRPercentilesAggregator {
|
|||
if (state == null) {
|
||||
return buildEmptyAggregation();
|
||||
} else {
|
||||
return new InternalHDRPercentileRanks(name, keys, state, keyed, format, pipelineAggregators(), metadata());
|
||||
return new InternalHDRPercentileRanks(name, keys, state, keyed, format, metadata());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,8 +54,7 @@ class HDRPercentileRanksAggregator extends AbstractHDRPercentilesAggregator {
|
|||
DoubleHistogram state;
|
||||
state = new DoubleHistogram(numberOfSignificantValueDigits);
|
||||
state.setAutoResize(true);
|
||||
return new InternalHDRPercentileRanks(name, keys, state,
|
||||
keyed, format, pipelineAggregators(), metadata());
|
||||
return new InternalHDRPercentileRanks(name, keys, state, keyed, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -45,7 +45,7 @@ class HDRPercentilesAggregator extends AbstractHDRPercentilesAggregator {
|
|||
if (state == null) {
|
||||
return buildEmptyAggregation();
|
||||
} else {
|
||||
return new InternalHDRPercentiles(name, keys, state, keyed, format, pipelineAggregators(), metadata());
|
||||
return new InternalHDRPercentiles(name, keys, state, keyed, format, metadata());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,6 @@ class HDRPercentilesAggregator extends AbstractHDRPercentilesAggregator {
|
|||
DoubleHistogram state;
|
||||
state = new DoubleHistogram(numberOfSignificantValueDigits);
|
||||
state.setAutoResize(true);
|
||||
return new InternalHDRPercentiles(name, keys, state,
|
||||
keyed,
|
||||
format, pipelineAggregators(), metadata());
|
||||
return new InternalHDRPercentiles(name, keys, state, keyed, format, metadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -34,9 +33,8 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i
|
|||
private final double sum;
|
||||
private final long count;
|
||||
|
||||
public InternalAvg(String name, double sum, long count, DocValueFormat format, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalAvg(String name, double sum, long count, DocValueFormat format, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.sum = sum;
|
||||
this.count = count;
|
||||
this.format = format;
|
||||
|
@ -97,7 +95,7 @@ public class InternalAvg extends InternalNumericMetricsAggregation.SingleValue i
|
|||
count += avg.count;
|
||||
kahanSummation.add(avg.sum);
|
||||
}
|
||||
return new InternalAvg(getName(), kahanSummation.value(), count, format, pipelineAggregators(), getMetadata());
|
||||
return new InternalAvg(getName(), kahanSummation.value(), count, format, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.util.BigArrays;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -35,9 +34,8 @@ import java.util.Objects;
|
|||
public final class InternalCardinality extends InternalNumericMetricsAggregation.SingleValue implements Cardinality {
|
||||
private final HyperLogLogPlusPlus counts;
|
||||
|
||||
InternalCardinality(String name, HyperLogLogPlusPlus counts, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalCardinality(String name, HyperLogLogPlusPlus counts, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.counts = counts;
|
||||
}
|
||||
|
||||
|
@ -92,7 +90,7 @@ public final class InternalCardinality extends InternalNumericMetricsAggregation
|
|||
if (cardinality.counts != null) {
|
||||
if (reduced == null) {
|
||||
reduced = new InternalCardinality(name, new HyperLogLogPlusPlus(cardinality.counts.precision(),
|
||||
BigArrays.NON_RECYCLING_INSTANCE, 1), pipelineAggregators(), getMetadata());
|
||||
BigArrays.NON_RECYCLING_INSTANCE, 1), getMetadata());
|
||||
}
|
||||
reduced.merge(cardinality);
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -44,8 +43,8 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat
|
|||
private final double sigma;
|
||||
|
||||
public InternalExtendedStats(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma,
|
||||
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, formatter, pipelineAggregators, metadata);
|
||||
DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, formatter, metadata);
|
||||
this.sumOfSqrs = sumOfSqrs;
|
||||
this.sigma = sigma;
|
||||
}
|
||||
|
@ -160,7 +159,7 @@ public class InternalExtendedStats extends InternalStats implements ExtendedStat
|
|||
}
|
||||
final InternalStats stats = super.reduce(aggregations, reduceContext);
|
||||
return new InternalExtendedStats(name, stats.getCount(), stats.getSum(), stats.getMin(), stats.getMax(), sumOfSqrs, sigma,
|
||||
format, pipelineAggregators(), getMetadata());
|
||||
format, getMetadata());
|
||||
}
|
||||
|
||||
static class Fields {
|
||||
|
|
|
@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
import org.HdrHistogram.DoubleHistogram;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles implements PercentileRanks {
|
||||
public static final String NAME = "hdr_percentile_ranks";
|
||||
|
||||
InternalHDRPercentileRanks(String name, double[] cdfValues, DoubleHistogram state, boolean keyed, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, cdfValues, state, keyed, formatter, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, cdfValues, state, keyed, formatter, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,8 +68,8 @@ public class InternalHDRPercentileRanks extends AbstractInternalHDRPercentiles i
|
|||
|
||||
@Override
|
||||
protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalHDRPercentileRanks(name, keys, merged, keyed, format, metadata);
|
||||
}
|
||||
|
||||
static double percentileRank(DoubleHistogram state, double value) {
|
||||
|
|
|
@ -21,19 +21,17 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
import org.HdrHistogram.DoubleHistogram;
|
||||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles implements Percentiles {
|
||||
public static final String NAME = "hdr_percentiles";
|
||||
|
||||
InternalHDRPercentiles(String name, double[] percents, DoubleHistogram state, boolean keyed, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, percents, state, keyed, formatter, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, percents, state, keyed, formatter, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,8 +71,8 @@ public class InternalHDRPercentiles extends AbstractInternalHDRPercentiles imple
|
|||
|
||||
@Override
|
||||
protected AbstractInternalHDRPercentiles createReduced(String name, double[] keys, DoubleHistogram merged, boolean keyed,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalHDRPercentiles(name, keys, merged, keyed, format, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalHDRPercentiles(name, keys, merged, keyed, format, metadata);
|
||||
}
|
||||
|
||||
public static class Iter implements Iterator<Percentile> {
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,8 @@ import java.util.Objects;
|
|||
public class InternalMax extends InternalNumericMetricsAggregation.SingleValue implements Max {
|
||||
private final double max;
|
||||
|
||||
public InternalMax(String name, double max, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalMax(String name, double max, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.format = formatter;
|
||||
this.max = max;
|
||||
}
|
||||
|
@ -76,7 +74,7 @@ public class InternalMax extends InternalNumericMetricsAggregation.SingleValue i
|
|||
for (InternalAggregation aggregation : aggregations) {
|
||||
max = Math.max(max, ((InternalMax) aggregation).max);
|
||||
}
|
||||
return new InternalMax(name, max, format, pipelineAggregators(), getMetadata());
|
||||
return new InternalMax(name, max, format, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -52,13 +51,8 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre
|
|||
private final TDigestState valuesSketch;
|
||||
private final double medianAbsoluteDeviation;
|
||||
|
||||
InternalMedianAbsoluteDeviation(String name,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata,
|
||||
DocValueFormat format,
|
||||
TDigestState valuesSketch) {
|
||||
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalMedianAbsoluteDeviation(String name, Map<String, Object> metadata, DocValueFormat format, TDigestState valuesSketch) {
|
||||
super(name, metadata);
|
||||
this.format = Objects.requireNonNull(format);
|
||||
this.valuesSketch = Objects.requireNonNull(valuesSketch);
|
||||
|
||||
|
@ -87,7 +81,7 @@ public class InternalMedianAbsoluteDeviation extends InternalNumericMetricsAggre
|
|||
valueMerged.add(madAggregation.valuesSketch);
|
||||
}
|
||||
|
||||
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata, format, valueMerged);
|
||||
return new InternalMedianAbsoluteDeviation(name, metadata, format, valueMerged);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,8 @@ import java.util.Objects;
|
|||
public class InternalMin extends InternalNumericMetricsAggregation.SingleValue implements Min {
|
||||
private final double min;
|
||||
|
||||
public InternalMin(String name, double min, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalMin(String name, double min, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.min = min;
|
||||
this.format = formatter;
|
||||
}
|
||||
|
@ -76,7 +74,7 @@ public class InternalMin extends InternalNumericMetricsAggregation.SingleValue i
|
|||
for (InternalAggregation aggregation : aggregations) {
|
||||
min = Math.min(min, ((InternalMin) aggregation).min);
|
||||
}
|
||||
return new InternalMin(getName(), min, this.format, pipelineAggregators(), getMetadata());
|
||||
return new InternalMin(getName(), min, this.format, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -37,8 +37,8 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
|
|||
protected DocValueFormat format = DEFAULT_FORMAT;
|
||||
|
||||
public abstract static class SingleValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.SingleValue {
|
||||
protected SingleValue(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
protected SingleValue(String name, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,6 +76,14 @@ public abstract class InternalNumericMetricsAggregation extends InternalAggregat
|
|||
}
|
||||
|
||||
public abstract static class MultiValue extends InternalNumericMetricsAggregation implements NumericMetricsAggregation.MultiValue {
|
||||
protected MultiValue(String name, Map<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) {
|
||||
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) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
super(name, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -46,8 +45,8 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue
|
|||
protected final double sum;
|
||||
|
||||
public InternalStats(String name, long count, double sum, double min, double max, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.count = count;
|
||||
this.sum = sum;
|
||||
this.min = min;
|
||||
|
@ -160,7 +159,7 @@ public class InternalStats extends InternalNumericMetricsAggregation.MultiValue
|
|||
// accurate than naive summation.
|
||||
kahanSummation.add(stats.getSum());
|
||||
}
|
||||
return new InternalStats(name, count, kahanSummation.value(), min, max, format, pipelineAggregators(), getMetadata());
|
||||
return new InternalStats(name, count, kahanSummation.value(), min, max, format, getMetadata());
|
||||
}
|
||||
|
||||
static class Fields {
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -33,9 +32,8 @@ import java.util.Objects;
|
|||
public class InternalSum extends InternalNumericMetricsAggregation.SingleValue implements Sum {
|
||||
private final double sum;
|
||||
|
||||
InternalSum(String name, double sum, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalSum(String name, double sum, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.sum = sum;
|
||||
this.format = formatter;
|
||||
}
|
||||
|
@ -79,7 +77,7 @@ public class InternalSum extends InternalNumericMetricsAggregation.SingleValue i
|
|||
double value = ((InternalSum) aggregation).sum;
|
||||
kahanSummation.add(value);
|
||||
}
|
||||
return new InternalSum(name, kahanSummation.value(), format, pipelineAggregators(), getMetadata());
|
||||
return new InternalSum(name, kahanSummation.value(), format, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.StreamOutput;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -35,9 +34,8 @@ import java.util.Objects;
|
|||
public class InternalValueCount extends InternalNumericMetricsAggregation.SingleValue implements ValueCount {
|
||||
private final long value;
|
||||
|
||||
InternalValueCount(String name, long value, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalValueCount(String name, long value, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
@ -75,7 +73,7 @@ public class InternalValueCount extends InternalNumericMetricsAggregation.Single
|
|||
for (InternalAggregation aggregation : aggregations) {
|
||||
valueCount += ((InternalValueCount) aggregation).value;
|
||||
}
|
||||
return new InternalValueCount(name, valueCount, pipelineAggregators(), getMetadata());
|
||||
return new InternalValueCount(name, valueCount, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -34,9 +33,8 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl
|
|||
private final double sum;
|
||||
private final double weight;
|
||||
|
||||
InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalWeightedAvg(String name, double sum, double weight, DocValueFormat format, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.sum = sum;
|
||||
this.weight = weight;
|
||||
this.format = format;
|
||||
|
@ -99,8 +97,7 @@ public class InternalWeightedAvg extends InternalNumericMetricsAggregation.Singl
|
|||
sumCompensation.add(avg.sum);
|
||||
}
|
||||
|
||||
return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(),
|
||||
format, pipelineAggregators(), getMetadata());
|
||||
return new InternalWeightedAvg(getName(), sumCompensation.value(), weightCompensation.value(), format, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -146,12 +146,12 @@ class MaxAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSource == null || bucket >= maxes.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalMax(name, maxes.get(bucket), formatter, pipelineAggregators(), metadata());
|
||||
return new InternalMax(name, maxes.get(bucket), formatter, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, pipelineAggregators(), metadata());
|
||||
return new InternalMax(name, Double.NEGATIVE_INFINITY, formatter, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -126,7 +126,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator.
|
|||
public InternalAggregation buildAggregation(long bucket) throws IOException {
|
||||
if (hasDataForBucket(bucket)) {
|
||||
final TDigestState valueSketch = valueSketches.get(bucket);
|
||||
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, valueSketch);
|
||||
return new InternalMedianAbsoluteDeviation(name, metadata(), format, valueSketch);
|
||||
} else {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public class MedianAbsoluteDeviationAggregator extends NumericMetricsAggregator.
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalMedianAbsoluteDeviation(name, pipelineAggregators(), metadata(), format, new TDigestState(compression));
|
||||
return new InternalMedianAbsoluteDeviation(name, metadata(), format, new TDigestState(compression));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -149,12 +149,12 @@ class MinAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSource == null || bucket >= mins.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalMin(name, mins.get(bucket), format, pipelineAggregators(), metadata());
|
||||
return new InternalMin(name, mins.get(bucket), format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalMin(name, Double.POSITIVE_INFINITY, format, pipelineAggregators(), metadata());
|
||||
return new InternalMin(name, Double.POSITIVE_INFINITY, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -164,12 +164,12 @@ class StatsAggregator extends NumericMetricsAggregator.MultiValue {
|
|||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalStats(name, counts.get(bucket), sums.get(bucket), mins.get(bucket),
|
||||
maxes.get(bucket), format, pipelineAggregators(), metadata());
|
||||
maxes.get(bucket), format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalStats(name, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, format, pipelineAggregators(), metadata());
|
||||
return new InternalStats(name, 0, 0, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -109,12 +109,12 @@ class SumAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSource == null || bucket >= sums.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalSum(name, sums.get(bucket), format, pipelineAggregators(), metadata());
|
||||
return new InternalSum(name, sums.get(bucket), format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalSum(name, 0.0, format, pipelineAggregators(), metadata());
|
||||
return new InternalSum(name, 0.0, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -90,12 +90,12 @@ class ValueCountAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSource == null || bucket >= counts.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalValueCount(name, counts.get(bucket), pipelineAggregators(), metadata());
|
||||
return new InternalValueCount(name, counts.get(bucket), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalValueCount(name, 0L, pipelineAggregators(), metadata());
|
||||
return new InternalValueCount(name, 0L, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -140,12 +140,12 @@ class WeightedAvgAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
if (valuesSources == null || bucket >= valueSums.size()) {
|
||||
return buildEmptyAggregation();
|
||||
}
|
||||
return new InternalWeightedAvg(name, valueSums.get(bucket), weights.get(bucket), format, pipelineAggregators(), metadata());
|
||||
return new InternalWeightedAvg(name, valueSums.get(bucket), weights.get(bucket), format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalWeightedAvg(name, 0.0, 0L, format, pipelineAggregators(), metadata());
|
||||
return new InternalWeightedAvg(name, 0.0, 0L, format, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
|
||||
|
@ -62,9 +61,9 @@ public class AvgBucketPipelineAggregator extends BucketMetricsPipelineAggregator
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
double avgValue = count == 0 ? Double.NaN : (sum / count);
|
||||
return new InternalSimpleValue(name(), avgValue, format, pipelineAggregators, metadata);
|
||||
return new InternalSimpleValue(name(), avgValue, format, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,14 +27,10 @@ import org.elasticsearch.search.aggregations.Aggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation.ReduceContext;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers;
|
||||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.SiblingPipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationPath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -90,7 +86,7 @@ public abstract class BucketMetricsPipelineAggregator extends SiblingPipelineAgg
|
|||
}
|
||||
}
|
||||
}
|
||||
return buildAggregation(Collections.emptyList(), metadata());
|
||||
return buildAggregation(metadata());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,12 +100,10 @@ public abstract class BucketMetricsPipelineAggregator extends SiblingPipelineAgg
|
|||
* Called after a collection run is finished to build the aggregation for
|
||||
* the collected state.
|
||||
*
|
||||
* @param pipelineAggregators
|
||||
* the pipeline aggregators to add to the resulting aggregation
|
||||
* @param metadata
|
||||
* the metadata to add to the resulting aggregation
|
||||
*/
|
||||
protected abstract InternalAggregation buildAggregation(List<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
|
||||
|
|
|
@ -115,8 +115,7 @@ public class BucketScriptPipelineAggregator extends PipelineAggregator {
|
|||
final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map(
|
||||
(p) -> (InternalAggregation) p).collect(Collectors.toList());
|
||||
|
||||
InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(),
|
||||
formatter, new ArrayList<>(), metadata());
|
||||
InternalSimpleValue simpleValue = new InternalSimpleValue(name(), returned.doubleValue(), formatter, metadata());
|
||||
aggs.add(simpleValue);
|
||||
InternalMultiBucketAggregation.InternalBucket newBucket = originalAgg.createBucket(new InternalAggregations(aggs),
|
||||
bucket);
|
||||
|
|
|
@ -86,7 +86,7 @@ public class CumulativeSumPipelineAggregator extends PipelineAggregator {
|
|||
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
|
||||
.map((p) -> (InternalAggregation) p)
|
||||
.collect(Collectors.toList());
|
||||
aggs.add(new InternalSimpleValue(name(), sum, formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), sum, formatter, metadata()));
|
||||
Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
newBuckets.add(newBucket);
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class DerivativePipelineAggregator extends PipelineAggregator {
|
|||
final List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map((p) -> {
|
||||
return (InternalAggregation) p;
|
||||
}).collect(Collectors.toList());
|
||||
aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, new ArrayList<PipelineAggregator>(), metadata()));
|
||||
aggs.add(new InternalDerivative(name(), gradient, xDiff, formatter, metadata()));
|
||||
Bucket newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
newBuckets.add(newBucket);
|
||||
} else {
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
|
||||
|
@ -80,7 +79,7 @@ public class ExtendedStatsBucketPipelineAggregator extends BucketMetricsPipeline
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, pipelineAggregators, metadata);
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
return new InternalExtendedStatsBucket(name(), count, sum, min, max, sumOfSqrs, sigma, format, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,9 +40,8 @@ public class InternalBucketMetricValue extends InternalNumericMetricsAggregation
|
|||
private double value;
|
||||
private String[] keys;
|
||||
|
||||
public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalBucketMetricValue(String name, String[] keys, double value, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.keys = keys;
|
||||
this.value = value;
|
||||
this.format = formatter;
|
||||
|
|
|
@ -32,9 +32,8 @@ import java.util.Objects;
|
|||
public class InternalDerivative extends InternalSimpleValue implements Derivative {
|
||||
private final double normalizationFactor;
|
||||
|
||||
InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, value, formatter, pipelineAggregators, metadata);
|
||||
InternalDerivative(String name, double value, double normalizationFactor, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, value, formatter, metadata);
|
||||
this.normalizationFactor = normalizationFactor;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,9 +30,8 @@ import java.util.Map;
|
|||
|
||||
public class InternalExtendedStatsBucket extends InternalExtendedStats implements ExtendedStatsBucket {
|
||||
InternalExtendedStatsBucket(String name, long count, double sum, double min, double max, double sumOfSqrs, double sigma,
|
||||
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, pipelineAggregators, metadata);
|
||||
DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, sumOfSqrs, sigma, formatter, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -44,9 +44,8 @@ public class InternalPercentilesBucket extends InternalNumericMetricsAggregation
|
|||
private final transient Map<Double, Double> percentileLookups = new HashMap<>();
|
||||
|
||||
InternalPercentilesBucket(String name, double[] percents, double[] percentiles, boolean keyed,
|
||||
DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
if ((percentiles.length == percents.length) == false) {
|
||||
throw new IllegalArgumentException("The number of provided percents and percentiles didn't match. percents: "
|
||||
+ Arrays.toString(percents) + ", percentiles: " + Arrays.toString(percentiles));
|
||||
|
|
|
@ -35,9 +35,8 @@ public class InternalSimpleValue extends InternalNumericMetricsAggregation.Singl
|
|||
public static final String NAME = "simple_value";
|
||||
protected final double value;
|
||||
|
||||
InternalSimpleValue(String name, double value, DocValueFormat formatter, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
InternalSimpleValue(String name, double value, DocValueFormat formatter, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.format = formatter;
|
||||
this.value = value;
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ import java.util.Map;
|
|||
|
||||
public class InternalStatsBucket extends InternalStats implements StatsBucket {
|
||||
public InternalStatsBucket(String name, long count, double sum, double min, double max, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, formatter, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, count, sum, min, max, formatter, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -69,9 +68,9 @@ public class MaxBucketPipelineAggregator extends BucketMetricsPipelineAggregator
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
String[] keys = maxBucketKeys.toArray(new String[maxBucketKeys.size()]);
|
||||
return new InternalBucketMetricValue(name(), keys, maxValue, format, Collections.emptyList(), metadata());
|
||||
return new InternalBucketMetricValue(name(), keys, maxValue, format, metadata());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -69,9 +68,9 @@ public class MinBucketPipelineAggregator extends BucketMetricsPipelineAggregator
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
String[] keys = minBucketKeys.toArray(new String[0]);
|
||||
return new InternalBucketMetricValue(name(), keys, minValue, format, Collections.emptyList(), metadata());
|
||||
return new InternalBucketMetricValue(name(), keys, minValue, format, metadata());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator {
|
|||
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
|
||||
.map((p) -> (InternalAggregation) p)
|
||||
.collect(Collectors.toList());
|
||||
aggs.add(new InternalSimpleValue(name(), movavg, formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), movavg, formatter, metadata()));
|
||||
newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator {
|
|||
aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false)
|
||||
.map((p) -> (InternalAggregation) p)
|
||||
.collect(Collectors.toList());
|
||||
aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, metadata()));
|
||||
|
||||
Bucket newBucket = factory.createBucket(newKey, bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class MovAvgPipelineAggregator extends PipelineAggregator {
|
|||
} else {
|
||||
// Not seen before, create fresh
|
||||
aggs = new ArrayList<>();
|
||||
aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), predictions[i], formatter, metadata()));
|
||||
|
||||
Bucket newBucket = factory.createBucket(newKey, 0, new InternalAggregations(aggs));
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public class MovFnPipelineAggregator extends PipelineAggregator {
|
|||
.stream(bucket.getAggregations().spliterator(), false)
|
||||
.map(InternalAggregation.class::cast)
|
||||
.collect(Collectors.toList());
|
||||
aggs.add(new InternalSimpleValue(name(), movavg, formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), movavg, formatter, metadata()));
|
||||
newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
index++;
|
||||
}
|
||||
|
|
|
@ -82,8 +82,7 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg
|
|||
}
|
||||
|
||||
@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
|
||||
// has been collected.
|
||||
Collections.sort(data);
|
||||
|
@ -102,6 +101,6 @@ public class PercentilesBucketPipelineAggregator extends BucketMetricsPipelineAg
|
|||
|
||||
// todo need postCollection() to clean up temp sorted data?
|
||||
|
||||
return new InternalPercentilesBucket(name(), percents, percentiles, keyed, format, pipelineAggregators, metadata);
|
||||
return new InternalPercentilesBucket(name(), percents, percentiles, keyed, format, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ public class SerialDiffPipelineAggregator extends PipelineAggregator {
|
|||
|
||||
List<InternalAggregation> aggs = StreamSupport.stream(bucket.getAggregations().spliterator(), false).map(
|
||||
(p) -> (InternalAggregation) p).collect(Collectors.toList());
|
||||
aggs.add(new InternalSimpleValue(name(), diff, formatter, new ArrayList<>(), metadata()));
|
||||
aggs.add(new InternalSimpleValue(name(), diff, formatter, metadata()));
|
||||
newBucket = factory.createBucket(factory.getKey(bucket), bucket.getDocCount(), new InternalAggregations(aggs));
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
|
||||
|
@ -65,7 +64,7 @@ public class StatsBucketPipelineAggregator extends BucketMetricsPipelineAggregat
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalStatsBucket(name(), count, sum, min, max, format, pipelineAggregators, metadata);
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
return new InternalStatsBucket(name(), count, sum, min, max, format, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.pipeline.BucketHelpers.GapPolicy;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator {
|
||||
|
@ -59,8 +58,8 @@ public class SumBucketPipelineAggregator extends BucketMetricsPipelineAggregator
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAggregation buildAggregation(List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalSimpleValue(name(), sum, format, pipelineAggregators, metadata);
|
||||
protected InternalAggregation buildAggregation(Map<String, Object> metadata) {
|
||||
return new InternalSimpleValue(name(), sum, format, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -78,6 +78,8 @@ import java.util.concurrent.atomic.AtomicReference;
|
|||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.elasticsearch.action.search.SearchProgressListener.NOOP;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
@ -384,8 +386,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE));
|
||||
result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
|
||||
new DocValueFormat[0]);
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW,
|
||||
Collections.emptyList(), Collections.emptyMap())));
|
||||
InternalAggregations aggs = new InternalAggregations(singletonList(new InternalMax("test", 1.0D, DocValueFormat.RAW, emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(0);
|
||||
consumer.consumeResult(result);
|
||||
|
@ -394,8 +395,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE));
|
||||
result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
|
||||
new DocValueFormat[0]);
|
||||
aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW,
|
||||
Collections.emptyList(), Collections.emptyMap())));
|
||||
aggs = new InternalAggregations(singletonList(new InternalMax("test", 3.0D, DocValueFormat.RAW, emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(2);
|
||||
consumer.consumeResult(result);
|
||||
|
@ -404,8 +404,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
new SearchShardTarget("node", new ShardId("a", "b", 0), null, OriginalIndices.NONE));
|
||||
result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(0, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), Float.NaN),
|
||||
new DocValueFormat[0]);
|
||||
aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW,
|
||||
Collections.emptyList(), Collections.emptyMap())));
|
||||
aggs = new InternalAggregations(singletonList(new InternalMax("test", 2.0D, DocValueFormat.RAW, emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(1);
|
||||
consumer.consumeResult(result);
|
||||
|
@ -475,7 +474,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[] {new ScoreDoc(0, number)}), number),
|
||||
new DocValueFormat[0]);
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap())));
|
||||
DocValueFormat.RAW, Collections.emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(id);
|
||||
result.size(1);
|
||||
|
@ -518,7 +517,7 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
result.topDocs(new TopDocsAndMaxScore(new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[0]), number),
|
||||
new DocValueFormat[0]);
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap())));
|
||||
DocValueFormat.RAW, Collections.emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(i);
|
||||
result.size(1);
|
||||
|
@ -868,8 +867,8 @@ public class SearchPhaseControllerTests extends ESTestCase {
|
|||
result.topDocs(new TopDocsAndMaxScore(
|
||||
new TopDocs(new TotalHits(1, TotalHits.Relation.EQUAL_TO), new ScoreDoc[]{new ScoreDoc(0, number)}), number),
|
||||
new DocValueFormat[0]);
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(new InternalMax("test", (double) number,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap())));
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(
|
||||
new InternalMax("test", (double) number, DocValueFormat.RAW, Collections.emptyMap())));
|
||||
result.aggregations(aggs);
|
||||
result.setShardIndex(id);
|
||||
result.size(1);
|
||||
|
|
|
@ -63,6 +63,8 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static java.util.Collections.emptyMap;
|
||||
import static java.util.Collections.singletonList;
|
||||
import static org.elasticsearch.test.InternalAggregationTestCase.emptyReduceContextBuilder;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
|
@ -361,14 +363,13 @@ public class SearchResponseMergerTests extends ESTestCase {
|
|||
for (int i = 0; i < numResponses; i++) {
|
||||
double value = randomDouble();
|
||||
maxValue = Math.max(value, maxValue);
|
||||
InternalMax max = new InternalMax(maxAggName, value, DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalMax max = new InternalMax(maxAggName, value, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalDateRange.Factory factory = new InternalDateRange.Factory();
|
||||
int count = randomIntBetween(1, 1000);
|
||||
totalCount += count;
|
||||
InternalDateRange.Bucket bucket = factory.createBucket("bucket", 0, 10000, count, InternalAggregations.EMPTY,
|
||||
false, DocValueFormat.RAW);
|
||||
InternalDateRange range = factory.create(rangeAggName, Collections.singletonList(bucket), DocValueFormat.RAW, false,
|
||||
Collections.emptyList(), Collections.emptyMap());
|
||||
InternalDateRange range = factory.create(rangeAggName, singletonList(bucket), DocValueFormat.RAW, false, emptyMap());
|
||||
InternalAggregations aggs = new InternalAggregations(Arrays.asList(range, max));
|
||||
SearchHits searchHits = new SearchHits(new SearchHit[0], null, Float.NaN);
|
||||
InternalSearchResponse internalSearchResponse = new InternalSearchResponse(searchHits, aggs, null, null, false, null, 1);
|
||||
|
|
|
@ -62,7 +62,7 @@ public class InternalAggregationsTests extends ESTestCase {
|
|||
|
||||
public void testNonFinalReduceTopLevelPipelineAggs() {
|
||||
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true),
|
||||
10, 1, Collections.emptyList(), Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
|
||||
10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
|
||||
List<InternalAggregations> aggs = singletonList(new InternalAggregations(Collections.singletonList(terms)));
|
||||
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(aggs, maxBucketReduceContext().forPartialReduction());
|
||||
assertEquals(1, reducedAggs.getTopLevelPipelineAggregators().size());
|
||||
|
@ -71,7 +71,7 @@ public class InternalAggregationsTests extends ESTestCase {
|
|||
|
||||
public void testFinalReduceTopLevelPipelineAggs() {
|
||||
InternalAggregation terms = new StringTerms("name", BucketOrder.key(true),
|
||||
10, 1, Collections.emptyList(), Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
|
||||
10, 1, Collections.emptyMap(), DocValueFormat.RAW, 25, false, 10, Collections.emptyList(), 0);
|
||||
|
||||
InternalAggregations aggs = new InternalAggregations(Collections.singletonList(terms));
|
||||
InternalAggregations reducedAggs = InternalAggregations.topLevelReduce(Collections.singletonList(aggs),
|
||||
|
|
|
@ -41,8 +41,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToAgg() {
|
||||
AggregationPath path = AggregationPath.parse("the_avg");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -55,8 +54,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToAggValue() {
|
||||
AggregationPath path = AggregationPath.parse("the_avg.value");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -69,8 +67,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToNothing() {
|
||||
AggregationPath path = AggregationPath.parse("foo.value");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -84,8 +81,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToUnknown() {
|
||||
AggregationPath path = AggregationPath.parse("the_avg.unknown");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -99,8 +95,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToBucketCount() {
|
||||
AggregationPath path = AggregationPath.parse("_bucket_count");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -113,8 +108,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToCount() {
|
||||
AggregationPath path = AggregationPath.parse("_count");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(1, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -127,8 +121,7 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
public void testResolveToKey() {
|
||||
AggregationPath path = AggregationPath.parse("_key");
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(agg));
|
||||
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -142,14 +135,13 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
AggregationPath path = AggregationPath.parse("string_terms['foo']>the_avg.value");
|
||||
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg));
|
||||
List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket(
|
||||
new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1,
|
||||
internalStringAggs, false, 0, DocValueFormat.RAW));
|
||||
|
||||
InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyList(),
|
||||
InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0,
|
||||
Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0);
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg));
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
@ -163,14 +155,13 @@ public class InternalMultiBucketAggregationTests extends ESTestCase {
|
|||
AggregationPath path = AggregationPath.parse("string_terms['bar']>the_avg.value");
|
||||
|
||||
List<LongTerms.Bucket> buckets = new ArrayList<>();
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1,
|
||||
DocValueFormat.RAW, Collections.emptyList(), Collections.emptyMap());
|
||||
InternalAggregation agg = new InternalAvg("the_avg", 2, 1, DocValueFormat.RAW, Collections.emptyMap());
|
||||
InternalAggregations internalStringAggs = new InternalAggregations(Collections.singletonList(agg));
|
||||
List<StringTerms.Bucket> stringBuckets = Collections.singletonList(new StringTerms.Bucket(
|
||||
new BytesRef("foo".getBytes(StandardCharsets.UTF_8), 0, "foo".getBytes(StandardCharsets.UTF_8).length), 1,
|
||||
internalStringAggs, false, 0, DocValueFormat.RAW));
|
||||
|
||||
InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0, Collections.emptyList(),
|
||||
InternalTerms termsAgg = new StringTerms("string_terms", BucketOrder.count(false), 1, 0,
|
||||
Collections.emptyMap(), DocValueFormat.RAW, 1, false, 0, stringBuckets, 0);
|
||||
InternalAggregations internalAggregations = new InternalAggregations(Collections.singletonList(termsAgg));
|
||||
LongTerms.Bucket bucket = new LongTerms.Bucket(19, 1, internalAggregations, false, 0, DocValueFormat.RAW);
|
||||
|
|
|
@ -31,6 +31,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
||||
public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregationTestCase<InternalAdjacencyMatrix> {
|
||||
|
||||
private List<String> keys;
|
||||
|
@ -66,15 +68,14 @@ public class InternalAdjacencyMatrixTests extends InternalMultiBucketAggregation
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalAdjacencyMatrix createTestInstance(String name, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, InternalAggregations aggregations) {
|
||||
protected InternalAdjacencyMatrix createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
|
||||
final List<InternalAdjacencyMatrix.InternalBucket> buckets = new ArrayList<>();
|
||||
for (int i = 0; i < keys.size(); ++i) {
|
||||
String key = keys.get(i);
|
||||
int docCount = randomIntBetween(0, 1000);
|
||||
buckets.add(new InternalAdjacencyMatrix.InternalBucket(key, docCount, aggregations));
|
||||
}
|
||||
return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators, metadata);
|
||||
return new InternalAdjacencyMatrix(name, buckets, emptyList(), metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.ParsedAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.test.InternalMultiBucketAggregationTestCase;
|
||||
import org.junit.After;
|
||||
|
||||
|
@ -155,8 +154,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalComposite createTestInstance(String name, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, InternalAggregations aggregations) {
|
||||
protected InternalComposite createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
|
||||
int numBuckets = randomIntBetween(0, size);
|
||||
List<InternalComposite.InternalBucket> buckets = new ArrayList<>();
|
||||
TreeSet<CompositeKey> keys = new TreeSet<>(getKeyComparator());
|
||||
|
@ -233,7 +231,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
|
|||
}
|
||||
|
||||
public void testReduceSame() throws IOException {
|
||||
InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyList(), Collections.emptyMap(),
|
||||
InternalComposite result = createTestInstance(randomAlphaOfLength(10), Collections.emptyMap(),
|
||||
InternalAggregations.EMPTY);
|
||||
List<InternalAggregation> toReduce = new ArrayList<>();
|
||||
int numSame = randomIntBetween(1, 10);
|
||||
|
@ -254,7 +252,7 @@ public class InternalCompositeTests extends InternalMultiBucketAggregationTestCa
|
|||
* Check that reducing with an unmapped index produces useful formats.
|
||||
*/
|
||||
public void testReduceUnmapped() throws IOException {
|
||||
InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyList(), emptyMap(), InternalAggregations.EMPTY);
|
||||
InternalComposite mapped = createTestInstance(randomAlphaOfLength(10), emptyMap(), InternalAggregations.EMPTY);
|
||||
List<DocValueFormat> rawFormats = formats.stream().map(f -> DocValueFormat.RAW).collect(toList());
|
||||
InternalComposite unmapped = new InternalComposite(mapped.getName(), mapped.getSize(), sourceNames,
|
||||
rawFormats, emptyList(), null, reverseMuls, true, emptyList(), emptyMap());
|
||||
|
|
|
@ -21,10 +21,9 @@ package org.elasticsearch.search.aggregations.bucket.filter;
|
|||
|
||||
import org.elasticsearch.common.io.stream.Writeable.Reader;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.test.InternalMultiBucketAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.ParsedMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.InternalFilters.InternalBucket;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.test.InternalMultiBucketAggregationTestCase;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -54,15 +53,14 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
|
|||
}
|
||||
|
||||
@Override
|
||||
protected InternalFilters createTestInstance(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata,
|
||||
InternalAggregations aggregations) {
|
||||
protected InternalFilters createTestInstance(String name, Map<String, Object> metadata, InternalAggregations aggregations) {
|
||||
final List<InternalFilters.InternalBucket> buckets = new ArrayList<>();
|
||||
for (int i = 0; i < keys.size(); ++i) {
|
||||
String key = keys.get(i);
|
||||
int docCount = randomIntBetween(0, 1000);
|
||||
buckets.add(new InternalFilters.InternalBucket(key, docCount, aggregations, keyed));
|
||||
}
|
||||
return new InternalFilters(name, buckets, keyed, pipelineAggregators, metadata);
|
||||
return new InternalFilters(name, buckets, keyed, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -96,7 +94,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
|
|||
protected InternalFilters mutateInstance(InternalFilters instance) {
|
||||
String name = instance.getName();
|
||||
List<InternalBucket> buckets = instance.getBuckets();
|
||||
List<PipelineAggregator> pipelineAggregators = instance.pipelineAggregators();
|
||||
Map<String, Object> metadata = instance.getMetadata();
|
||||
switch (between(0, 2)) {
|
||||
case 0:
|
||||
|
@ -116,6 +113,6 @@ public class InternalFiltersTests extends InternalMultiBucketAggregationTestCase
|
|||
metadata.put(randomAlphaOfLength(15), randomInt());
|
||||
break;
|
||||
}
|
||||
return new InternalFilters(name, buckets, keyed, pipelineAggregators, metadata);
|
||||
return new InternalFilters(name, buckets, keyed, metadata);
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue