Remove pipline aggs from agg result tree (backport of #54716) (#54920)

This removes pipeline aggregators from the aggregation result tree
except for a single field used for backwards compatibility with pre-7.8
versions of Elasticsearch. That field isn't populated unless we are
serializing to pre-7.8 Elasticsearch. So, good news! We no longer build
pipeline aggregators on the data node. Most of the time.
This commit is contained in:
Nik Everett 2020-04-07 17:22:23 -04:00 committed by GitHub
parent 100f7258c7
commit ce7ae4a7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
182 changed files with 489 additions and 1103 deletions

View File

@ -30,13 +30,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.metrics.MetricsAggregator; import org.elasticsearch.search.aggregations.metrics.MetricsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ArrayValuesSource.NumericArrayValuesSource; import org.elasticsearch.search.aggregations.support.ArrayValuesSource.NumericArrayValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -50,9 +48,8 @@ final class MatrixStatsAggregator extends MetricsAggregator {
ObjectArray<RunningStats> stats; ObjectArray<RunningStats> stats;
MatrixStatsAggregator(String name, Map<String, ValuesSource.Numeric> valuesSources, SearchContext context, MatrixStatsAggregator(String name, Map<String, ValuesSource.Numeric> valuesSources, SearchContext context,
Aggregator parent, MultiValueMode multiValueMode, List<PipelineAggregator> pipelineAggregators, Aggregator parent, MultiValueMode multiValueMode, Map<String,Object> metadata) throws IOException {
Map<String,Object> metadata) throws IOException { super(name, context, parent, metadata);
super(name, context, parent, pipelineAggregators, metadata);
if (valuesSources != null && !valuesSources.isEmpty()) { if (valuesSources != null && !valuesSources.isEmpty()) {
this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode); this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode);
stats = context.bigArrays().newObjectArray(1); stats = context.bigArrays().newObjectArray(1);

View File

@ -23,14 +23,12 @@ import org.elasticsearch.search.MultiValueMode;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ArrayValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ArrayValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFactory<ValuesSource.Numeric> { final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFactory<ValuesSource.Numeric> {
@ -51,10 +49,9 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) Map<String, Object> metadata)
throws IOException { throws IOException {
return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, pipelineAggregators, metadata); return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, metadata);
} }
@Override @Override
@ -62,8 +59,7 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new MatrixStatsAggregator(name, valuesSources, searchContext, parent, multiValueMode, pipelineAggregators, metadata); return new MatrixStatsAggregator(name, valuesSources, searchContext, parent, multiValueMode, metadata);
} }
} }

View File

@ -23,12 +23,10 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource> public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource>
@ -48,7 +46,6 @@ public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
HashMap<String, VS> valuesSources = new HashMap<>(); HashMap<String, VS> valuesSources = new HashMap<>();
@ -59,22 +56,19 @@ public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource
} }
} }
if (valuesSources.isEmpty()) { if (valuesSources.isEmpty()) {
return createUnmapped(searchContext, parent, pipelineAggregators, metadata); return createUnmapped(searchContext, parent, metadata);
} }
return doCreateInternal(valuesSources, searchContext, parent, return doCreateInternal(valuesSources, searchContext, parent, collectsFromSingleBucket, metadata);
collectsFromSingleBucket, pipelineAggregators, metadata);
} }
protected abstract Aggregator createUnmapped(SearchContext searchContext, protected abstract Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException; Map<String, Object> metadata) throws IOException;
protected abstract Aggregator doCreateInternal(Map<String, VS> valuesSources, protected abstract Aggregator doCreateInternal(Map<String, VS> valuesSources,
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException; Map<String, Object> metadata) throws IOException;
} }

View File

@ -26,14 +26,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals; import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> { public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> {
@ -56,12 +54,11 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<Wit
} }
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { return new NonCollectingAggregator(name, searchContext, parent, metadata) {
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalChildren(name, 0, buildEmptySubAggregations(), metadata());
} }
}; };
} }
@ -70,13 +67,12 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<Wit
protected Aggregator doCreateInternal(WithOrdinals valuesSource, protected Aggregator doCreateInternal(WithOrdinals valuesSource,
SearchContext searchContext, Aggregator parent, SearchContext searchContext, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher()); long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher());
if (collectsFromSingleBucket) { if (collectsFromSingleBucket) {
return new ParentToChildrenAggregator(name, factories, searchContext, parent, childFilter, return new ParentToChildrenAggregator(name, factories, searchContext, parent, childFilter,
parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); parentFilter, valuesSource, maxOrd, metadata);
} else { } else {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }

View File

@ -24,12 +24,10 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -42,19 +40,18 @@ public class ChildrenToParentAggregator extends ParentJoinAggregator {
public ChildrenToParentAggregator(String name, AggregatorFactories factories, public ChildrenToParentAggregator(String name, AggregatorFactories factories,
SearchContext context, Aggregator parent, Query childFilter, SearchContext context, Aggregator parent, Query childFilter,
Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource, Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource,
long maxOrd, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { long maxOrd, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, metadata);
} }
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalParent(name, bucketDocCount(owningBucketOrdinal), return new InternalParent(name, bucketDocCount(owningBucketOrdinal),
bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata()); bucketAggregations(owningBucketOrdinal), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(), return new InternalParent(name, 0, buildEmptySubAggregations(), metadata());
metadata());
} }
} }

View File

@ -22,19 +22,16 @@ package org.elasticsearch.join.aggregations;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Results of the {@link ParentToChildrenAggregator}. * Results of the {@link ParentToChildrenAggregator}.
*/ */
public class InternalChildren extends InternalSingleBucketAggregation implements Children { public class InternalChildren extends InternalSingleBucketAggregation implements Children {
public InternalChildren(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators, public InternalChildren(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -51,6 +48,6 @@ public class InternalChildren extends InternalSingleBucketAggregation implements
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalChildren(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalChildren(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -22,19 +22,16 @@ package org.elasticsearch.join.aggregations;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Results of the {@link ChildrenToParentAggregator}. * Results of the {@link ChildrenToParentAggregator}.
*/ */
public class InternalParent extends InternalSingleBucketAggregation implements Parent { public class InternalParent extends InternalSingleBucketAggregation implements Parent {
public InternalParent(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators, public InternalParent(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -51,6 +48,6 @@ public class InternalParent extends InternalSingleBucketAggregation implements P
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalParent(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalParent(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -26,14 +26,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals; import org.elasticsearch.search.aggregations.support.ValuesSource.Bytes.WithOrdinals;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> { public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> {
@ -57,11 +55,11 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithO
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalParent(name, 0, buildEmptySubAggregations(), metadata());
} }
}; };
} }
@ -70,13 +68,12 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithO
protected Aggregator doCreateInternal(WithOrdinals valuesSource, protected Aggregator doCreateInternal(WithOrdinals valuesSource,
SearchContext searchContext, Aggregator children, SearchContext searchContext, Aggregator children,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher()); long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher());
if (collectsFromSingleBucket) { if (collectsFromSingleBucket) {
return new ChildrenToParentAggregator(name, factories, searchContext, children, childFilter, return new ChildrenToParentAggregator(name, factories, searchContext, children, childFilter,
parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata); parentFilter, valuesSource, maxOrd, metadata);
} else { } else {
return asMultiBucketAggregator(this, searchContext, children); return asMultiBucketAggregator(this, searchContext, children);
} }

View File

@ -24,8 +24,8 @@ import org.apache.lucene.index.SortedSetDocValues;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.lucene.search.Scorable; import org.apache.lucene.search.Scorable;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.ScoreMode; import org.apache.lucene.search.ScoreMode;
import org.apache.lucene.search.Scorer;
import org.apache.lucene.search.Weight; import org.apache.lucene.search.Weight;
import org.apache.lucene.util.Bits; import org.apache.lucene.util.Bits;
import org.elasticsearch.common.lease.Releasables; import org.elasticsearch.common.lease.Releasables;
@ -37,12 +37,10 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -73,9 +71,8 @@ public abstract class ParentJoinAggregator extends BucketsAggregator implements
Query outFilter, Query outFilter,
ValuesSource.Bytes.WithOrdinals valuesSource, ValuesSource.Bytes.WithOrdinals valuesSource,
long maxOrd, long maxOrd,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
if (maxOrd > Integer.MAX_VALUE) { if (maxOrd > Integer.MAX_VALUE) {
throw new IllegalStateException("the number of parent [" + maxOrd + "] + is greater than the allowed limit " + throw new IllegalStateException("the number of parent [" + maxOrd + "] + is greater than the allowed limit " +

View File

@ -23,12 +23,10 @@ import org.elasticsearch.common.ParseField;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ParentToChildrenAggregator extends ParentJoinAggregator { public class ParentToChildrenAggregator extends ParentJoinAggregator {
@ -38,19 +36,18 @@ public class ParentToChildrenAggregator extends ParentJoinAggregator {
public ParentToChildrenAggregator(String name, AggregatorFactories factories, public ParentToChildrenAggregator(String name, AggregatorFactories factories,
SearchContext context, Aggregator parent, Query childFilter, SearchContext context, Aggregator parent, Query childFilter,
Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource, Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource,
long maxOrd, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { long maxOrd, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, pipelineAggregators, metadata); super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, metadata);
} }
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalChildren(name, bucketDocCount(owningBucketOrdinal), return new InternalChildren(name, bucketDocCount(owningBucketOrdinal),
bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata()); bucketAggregations(owningBucketOrdinal), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(), return new InternalChildren(name, 0, buildEmptySubAggregations(), metadata());
metadata());
} }
} }

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase; import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -45,8 +44,8 @@ public class InternalChildrenTests extends InternalSingleBucketAggregationTestCa
@Override @Override
protected InternalChildren createTestInstance(String name, long docCount, InternalAggregations aggregations, protected InternalChildren createTestInstance(String name, long docCount, InternalAggregations aggregations,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalChildren(name, docCount, aggregations, pipelineAggregators, metadata); return new InternalChildren(name, docCount, aggregations, metadata);
} }
@Override @Override

View File

@ -19,10 +19,6 @@
package org.elasticsearch.join.aggregations; package org.elasticsearch.join.aggregations;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.elasticsearch.common.ParseField; import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.io.stream.Writeable.Reader; import org.elasticsearch.common.io.stream.Writeable.Reader;
import org.elasticsearch.common.xcontent.NamedXContentRegistry.Entry; import org.elasticsearch.common.xcontent.NamedXContentRegistry.Entry;
@ -30,7 +26,10 @@ import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase; import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class InternalParentTests extends InternalSingleBucketAggregationTestCase<InternalParent> { public class InternalParentTests extends InternalSingleBucketAggregationTestCase<InternalParent> {
@ -44,8 +43,8 @@ public class InternalParentTests extends InternalSingleBucketAggregationTestCase
@Override @Override
protected InternalParent createTestInstance(String name, long docCount, InternalAggregations aggregations, protected InternalParent createTestInstance(String name, long docCount, InternalAggregations aggregations,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
return new InternalParent(name, docCount, aggregations, pipelineAggregators, metadata); return new InternalParent(name, docCount, aggregations, metadata);
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.breaker.CircuitBreaker;
import org.elasticsearch.common.breaker.CircuitBreakingException; import org.elasticsearch.common.breaker.CircuitBreakingException;
import org.elasticsearch.indices.breaker.CircuitBreakerService; import org.elasticsearch.indices.breaker.CircuitBreakerService;
import org.elasticsearch.search.SearchShardTarget; import org.elasticsearch.search.SearchShardTarget;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.internal.SearchContext.Lifetime; import org.elasticsearch.search.internal.SearchContext.Lifetime;
import org.elasticsearch.search.query.QueryPhaseExecutionException; import org.elasticsearch.search.query.QueryPhaseExecutionException;
@ -53,7 +52,6 @@ public abstract class AggregatorBase extends Aggregator {
protected BucketCollector collectableSubAggregators; protected BucketCollector collectableSubAggregators;
private Map<String, Aggregator> subAggregatorbyName; private Map<String, Aggregator> subAggregatorbyName;
private final List<PipelineAggregator> pipelineAggregators;
private final CircuitBreakerService breakerService; private final CircuitBreakerService breakerService;
private long requestBytesUsed; private long requestBytesUsed;
@ -67,9 +65,8 @@ public abstract class AggregatorBase extends Aggregator {
* @param metadata The metadata associated with this aggregator * @param metadata The metadata associated with this aggregator
*/ */
protected AggregatorBase(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, protected AggregatorBase(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
this.name = name; this.name = name;
this.pipelineAggregators = pipelineAggregators;
this.metadata = metadata; this.metadata = metadata;
this.parent = parent; this.parent = parent;
this.context = context; this.context = context;
@ -152,10 +149,6 @@ public abstract class AggregatorBase extends Aggregator {
return this.metadata; return this.metadata;
} }
public List<PipelineAggregator> pipelineAggregators() {
return this.pipelineAggregators;
}
/** /**
* Get a {@link LeafBucketCollector} for the given ctx, which should * Get a {@link LeafBucketCollector} for the given ctx, which should
* delegate to the given collector. * delegate to the given collector.

View File

@ -223,13 +223,6 @@ public class AggregatorFactories {
return factories.length; return factories.length;
} }
/**
* @return the number of pipeline aggregator factories
*/
public int countPipelineAggregators() {
return pipelineAggregatorFactories.size();
}
public static class Builder implements Writeable, ToXContentObject { public static class Builder implements Writeable, ToXContentObject {
private final Set<String> names = new HashSet<>(); private final Set<String> names = new HashSet<>();

View File

@ -26,12 +26,10 @@ import org.elasticsearch.common.lease.Releasables;
import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.BigArrays;
import org.elasticsearch.common.util.ObjectArray; import org.elasticsearch.common.util.ObjectArray;
import org.elasticsearch.index.query.QueryShardContext; import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.internal.SearchContext.Lifetime; import org.elasticsearch.search.internal.SearchContext.Lifetime;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public abstract class AggregatorFactory { public abstract class AggregatorFactory {
@ -201,7 +199,6 @@ public abstract class AggregatorFactory {
protected abstract Aggregator createInternal(SearchContext searchContext, protected abstract Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException; Map<String, Object> metadata) throws IOException;
/** /**
@ -222,7 +219,7 @@ public abstract class AggregatorFactory {
* @return The created aggregator * @return The created aggregator
*/ */
public final Aggregator create(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket) throws IOException { public final Aggregator create(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket) throws IOException {
return createInternal(searchContext, parent, collectsFromSingleBucket, this.factories.createPipelineAggregators(), this.metadata); return createInternal(searchContext, parent, collectsFromSingleBucket, this.metadata);
} }
public AggregatorFactory getParent() { public AggregatorFactory getParent() {

View File

@ -41,7 +41,6 @@ import java.util.function.Function;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
import java.util.function.Supplier; import java.util.function.Supplier;
import static java.util.Collections.emptyList;
import static java.util.Objects.requireNonNull; import static java.util.Objects.requireNonNull;
/** /**
@ -147,7 +146,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
protected final Map<String, Object> metadata; protected final Map<String, Object> metadata;
private final List<PipelineAggregator> pipelineAggregators;
private List<PipelineAggregator> pipelineAggregatorsForBwcSerialization; private List<PipelineAggregator> pipelineAggregatorsForBwcSerialization;
/** /**
@ -157,20 +155,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
*/ */
protected InternalAggregation(String name, Map<String, Object> metadata) { protected InternalAggregation(String name, Map<String, Object> metadata) {
this.name = name; 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;
this.metadata = metadata; this.metadata = metadata;
} }
@ -191,7 +175,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
protected InternalAggregation(StreamInput in) throws IOException { protected InternalAggregation(StreamInput in) throws IOException {
name = in.readString(); name = in.readString();
metadata = in.readMap(); metadata = in.readMap();
pipelineAggregators = emptyList();
if (in.getVersion().before(Version.V_7_8_0)) { if (in.getVersion().before(Version.V_7_8_0)) {
in.readNamedWriteableList(PipelineAggregator.class); in.readNamedWriteableList(PipelineAggregator.class);
} }
@ -310,14 +293,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
return metadata; return metadata;
} }
/**
* @deprecated soon to be removed because it is not longer needed
*/
@Deprecated
public List<PipelineAggregator> pipelineAggregators() {
return pipelineAggregators;
}
/** /**
* The {@linkplain PipelineAggregator}s sent to older versions of Elasticsearch. * The {@linkplain PipelineAggregator}s sent to older versions of Elasticsearch.
* @deprecated only use these for serializing to older Elasticsearch versions * @deprecated only use these for serializing to older Elasticsearch versions
@ -353,7 +328,7 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(name, metadata, pipelineAggregators); return Objects.hash(name, metadata);
} }
@Override @Override
@ -365,7 +340,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
InternalAggregation other = (InternalAggregation) obj; InternalAggregation other = (InternalAggregation) obj;
return Objects.equals(name, other.name) && return Objects.equals(name, other.name) &&
Objects.equals(pipelineAggregators, other.pipelineAggregators) &&
Objects.equals(metadata, other.metadata); Objects.equals(metadata, other.metadata);
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.Writeable; import org.elasticsearch.common.io.stream.Writeable;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree;
import java.io.IOException; import java.io.IOException;
@ -41,14 +40,6 @@ public abstract class InternalMultiBucketAggregation<A extends InternalMultiBuck
super(name, metadata); super(name, metadata);
} }
/**
* @deprecated being removed
*/
@Deprecated
public InternalMultiBucketAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata);
}
/** /**
* Read from a stream. * Read from a stream.
*/ */

View File

@ -20,11 +20,9 @@
package org.elasticsearch.search.aggregations; package org.elasticsearch.search.aggregations;
import org.apache.lucene.index.LeafReaderContext; import org.apache.lucene.index.LeafReaderContext;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -34,13 +32,13 @@ import java.util.Map;
public abstract class NonCollectingAggregator extends AggregatorBase { public abstract class NonCollectingAggregator extends AggregatorBase {
protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent, AggregatorFactories subFactories, protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent, AggregatorFactories subFactories,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, subFactories, context, parent, pipelineAggregators, metadata); super(name, subFactories, context, parent, metadata);
} }
protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent, protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
this(name, context, parent, AggregatorFactories.EMPTY, pipelineAggregators, metadata); this(name, context, parent, AggregatorFactories.EMPTY, metadata);
} }
@Override @Override

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.AggregationPath; import org.elasticsearch.search.aggregations.support.AggregationPath;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.sort.SortOrder; import org.elasticsearch.search.sort.SortOrder;
@ -35,7 +34,6 @@ import org.elasticsearch.search.sort.SortOrder;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.IntConsumer; import java.util.function.IntConsumer;
@ -46,8 +44,8 @@ public abstract class BucketsAggregator extends AggregatorBase {
private IntArray docCounts; private IntArray docCounts;
public BucketsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, public BucketsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
bigArrays = context.bigArrays(); bigArrays = context.bigArrays();
docCounts = bigArrays.newIntArray(1, true); docCounts = bigArrays.newIntArray(1, true);
if (context.aggregations() != null) { if (context.aggregations() != null) {

View File

@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.BucketCollector; import org.elasticsearch.search.aggregations.BucketCollector;
import org.elasticsearch.search.aggregations.MultiBucketCollector; import org.elasticsearch.search.aggregations.MultiBucketCollector;
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregator; import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -37,8 +36,8 @@ public abstract class DeferableBucketAggregator extends BucketsAggregator {
private DeferringBucketCollector recordingWrapper; private DeferringBucketCollector recordingWrapper;
protected DeferableBucketAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, protected DeferableBucketAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree; import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree;
import org.elasticsearch.search.aggregations.support.AggregationPath; import org.elasticsearch.search.aggregations.support.AggregationPath;
@ -53,8 +52,8 @@ public abstract class InternalSingleBucketAggregation extends InternalAggregatio
* @param aggregations The already built sub-aggregations that are associated with the bucket. * @param aggregations The already built sub-aggregations that are associated with the bucket.
*/ */
protected InternalSingleBucketAggregation(String name, long docCount, InternalAggregations aggregations, protected InternalSingleBucketAggregation(String name, long docCount, InternalAggregations aggregations,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.docCount = docCount; this.docCount = docCount;
this.aggregations = aggregations; this.aggregations = aggregations;
} }

View File

@ -38,7 +38,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -129,9 +128,8 @@ public class AdjacencyMatrixAggregator extends BucketsAggregator {
private final String separator; private final String separator;
public AdjacencyMatrixAggregator(String name, AggregatorFactories factories, String separator, String[] keys, public AdjacencyMatrixAggregator(String name, AggregatorFactories factories, String separator, String[] keys,
Weight[] filters, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Weight[] filters, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, context, parent, metadata);
super(name, factories, context, parent, pipelineAggregators, metadata);
this.separator = separator; this.separator = separator;
this.keys = keys; this.keys = keys;
this.filters = filters; this.filters = filters;
@ -210,13 +208,13 @@ public class AdjacencyMatrixAggregator extends BucketsAggregator {
pos++; pos++;
} }
} }
return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators(), metadata()); return new InternalAdjacencyMatrix(name, buckets, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
List<InternalAdjacencyMatrix.InternalBucket> buckets = new ArrayList<>(0); List<InternalAdjacencyMatrix.InternalBucket> buckets = new ArrayList<>(0);
return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators(), metadata()); return new InternalAdjacencyMatrix(name, buckets, metadata());
} }
final long bucketOrd(long owningBucketOrdinal, int filterOrd) { final long bucketOrd(long owningBucketOrdinal, int filterOrd) {

View File

@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrixAggregator.KeyedFilter; import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrixAggregator.KeyedFilter;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -61,10 +60,8 @@ public class AdjacencyMatrixAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new AdjacencyMatrixAggregator(name, factories, separator, keys, weights, searchContext, parent, return new AdjacencyMatrixAggregator(name, factories, separator, keys, weights, searchContext, parent, metadata);
pipelineAggregators, metadata);
} }
} }

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -120,9 +119,8 @@ public class InternalAdjacencyMatrix
private final List<InternalBucket> buckets; private final List<InternalBucket> buckets;
private Map<String, InternalBucket> bucketMap; private Map<String, InternalBucket> bucketMap;
public InternalAdjacencyMatrix(String name, List<InternalBucket> buckets, public InternalAdjacencyMatrix(String name, List<InternalBucket> buckets, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.buckets = buckets; this.buckets = buckets;
} }
@ -155,7 +153,7 @@ public class InternalAdjacencyMatrix
@Override @Override
public InternalAdjacencyMatrix create(List<InternalBucket> buckets) { public InternalAdjacencyMatrix create(List<InternalBucket> buckets) {
return new InternalAdjacencyMatrix(this.name, buckets, this.pipelineAggregators(), this.metadata); return new InternalAdjacencyMatrix(this.name, buckets, this.metadata);
} }
@Override @Override
@ -206,8 +204,7 @@ public class InternalAdjacencyMatrix
} }
Collections.sort(reducedBuckets, Comparator.comparing(InternalBucket::getKey)); Collections.sort(reducedBuckets, Comparator.comparing(InternalBucket::getKey));
InternalAdjacencyMatrix reduced = new InternalAdjacencyMatrix(name, reducedBuckets, pipelineAggregators(), InternalAdjacencyMatrix reduced = new InternalAdjacencyMatrix(name, reducedBuckets, getMetadata());
getMetadata());
return reduced; return reduced;
} }

View File

@ -23,11 +23,9 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
class CompositeAggregationFactory extends AggregatorFactory { class CompositeAggregationFactory extends AggregatorFactory {
@ -46,8 +44,7 @@ class CompositeAggregationFactory extends AggregatorFactory {
@Override @Override
protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new CompositeAggregator(name, factories, searchContext, parent, pipelineAggregators, metadata, return new CompositeAggregator(name, factories, searchContext, parent, metadata, size, sources, afterKey);
size, sources, afterKey);
} }
} }

View File

@ -53,7 +53,6 @@ import org.elasticsearch.search.aggregations.MultiBucketCollector;
import org.elasticsearch.search.aggregations.MultiBucketConsumerService; import org.elasticsearch.search.aggregations.MultiBucketConsumerService;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.geogrid.CellIdSource; import org.elasticsearch.search.aggregations.bucket.geogrid.CellIdSource;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.searchafter.SearchAfterBuilder; import org.elasticsearch.search.searchafter.SearchAfterBuilder;
@ -89,9 +88,9 @@ final class CompositeAggregator extends BucketsAggregator {
private boolean earlyTerminated; private boolean earlyTerminated;
CompositeAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, CompositeAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, Map<String, Object> metadata,
int size, CompositeValuesSourceConfig[] sourceConfigs, CompositeKey rawAfterKey) throws IOException { int size, CompositeValuesSourceConfig[] sourceConfigs, CompositeKey rawAfterKey) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
this.size = size; this.size = size;
this.sourceNames = Arrays.stream(sourceConfigs).map(CompositeValuesSourceConfig::name).collect(Collectors.toList()); this.sourceNames = Arrays.stream(sourceConfigs).map(CompositeValuesSourceConfig::name).collect(Collectors.toList());
this.reverseMuls = Arrays.stream(sourceConfigs).mapToInt(CompositeValuesSourceConfig::reverseMul).toArray(); this.reverseMuls = Arrays.stream(sourceConfigs).mapToInt(CompositeValuesSourceConfig::reverseMul).toArray();
@ -153,13 +152,13 @@ final class CompositeAggregator extends BucketsAggregator {
} }
CompositeKey lastBucket = num > 0 ? buckets[num-1].getRawKey() : null; CompositeKey lastBucket = num > 0 ? buckets[num-1].getRawKey() : null;
return new InternalComposite(name, size, sourceNames, formats, Arrays.asList(buckets), lastBucket, reverseMuls, return new InternalComposite(name, size, sourceNames, formats, Arrays.asList(buckets), lastBucket, reverseMuls,
earlyTerminated, pipelineAggregators(), metadata()); earlyTerminated, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalComposite(name, size, sourceNames, formats, Collections.emptyList(), null, reverseMuls, return new InternalComposite(name, size, sourceNames, formats, Collections.emptyList(), null, reverseMuls,
false, pipelineAggregators(), metadata()); false, metadata());
} }
private void finishLeaf() { private void finishLeaf() {

View File

@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.AbstractMap; import java.util.AbstractMap;
@ -58,8 +57,8 @@ public class InternalComposite
InternalComposite(String name, int size, List<String> sourceNames, List<DocValueFormat> formats, InternalComposite(String name, int size, List<String> sourceNames, List<DocValueFormat> formats,
List<InternalBucket> buckets, CompositeKey afterKey, int[] reverseMuls, boolean earlyTerminated, List<InternalBucket> buckets, CompositeKey afterKey, int[] reverseMuls, boolean earlyTerminated,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.sourceNames = sourceNames; this.sourceNames = sourceNames;
this.formats = formats; this.formats = formats;
this.buckets = buckets; this.buckets = buckets;
@ -131,7 +130,7 @@ public class InternalComposite
* to be able to retrieve the next page even if all buckets have been filtered. * to be able to retrieve the next page even if all buckets have been filtered.
*/ */
return new InternalComposite(name, size, sourceNames, formats, newBuckets, afterKey, return new InternalComposite(name, size, sourceNames, formats, newBuckets, afterKey,
reverseMuls, earlyTerminated, pipelineAggregators(), getMetadata()); reverseMuls, earlyTerminated, getMetadata());
} }
@Override @Override
@ -222,7 +221,7 @@ public class InternalComposite
lastKey = lastBucket.getRawKey(); lastKey = lastBucket.getRawKey();
} }
return new InternalComposite(name, size, sourceNames, reducedFormats, result, lastKey, reverseMuls, return new InternalComposite(name, size, sourceNames, reducedFormats, result, lastKey, reverseMuls,
earlyTerminated, pipelineAggregators(), metadata); earlyTerminated, metadata);
} }
@Override @Override

View File

@ -29,11 +29,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -48,9 +46,9 @@ public class FilterAggregator extends BucketsAggregator implements SingleBucketA
Supplier<Weight> filter, Supplier<Weight> filter,
AggregatorFactories factories, AggregatorFactories factories,
SearchContext context, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
this.filter = filter; this.filter = filter;
} }
@ -71,13 +69,12 @@ public class FilterAggregator extends BucketsAggregator implements SingleBucketA
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalFilter(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(), return new InternalFilter(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalFilter(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalFilter(name, 0, buildEmptySubAggregations(), metadata());
} }
} }

View File

@ -29,11 +29,9 @@ import org.elasticsearch.search.aggregations.AggregationInitializationException;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class FilterAggregatorFactory extends AggregatorFactory { public class FilterAggregatorFactory extends AggregatorFactory {
@ -72,9 +70,8 @@ public class FilterAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new FilterAggregator(name, () -> this.getWeight(), factories, searchContext, parent, pipelineAggregators, metadata); return new FilterAggregator(name, () -> this.getWeight(), factories, searchContext, parent, metadata);
} }
} }

View File

@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -123,9 +122,8 @@ public class FiltersAggregator extends BucketsAggregator {
private final int totalNumKeys; private final int totalNumKeys;
public FiltersAggregator(String name, AggregatorFactories factories, String[] keys, Supplier<Weight[]> filters, boolean keyed, public FiltersAggregator(String name, AggregatorFactories factories, String[] keys, Supplier<Weight[]> filters, boolean keyed,
String otherBucketKey, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, String otherBucketKey, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, context, parent, metadata);
super(name, factories, context, parent, pipelineAggregators, metadata);
this.keyed = keyed; this.keyed = keyed;
this.keys = keys; this.keys = keys;
this.filters = filters; this.filters = filters;

View File

@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.KeyedFilter; import org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.KeyedFilter;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -89,10 +88,9 @@ public class FiltersAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new FiltersAggregator(name, factories, keys, () -> getWeights(searchContext), keyed, return new FiltersAggregator(name, factories, keys, () -> getWeights(searchContext), keyed,
otherBucket ? otherBucketKey : null, searchContext, parent, pipelineAggregators, metadata); otherBucket ? otherBucketKey : null, searchContext, parent, metadata);
} }

View File

@ -22,16 +22,13 @@ package org.elasticsearch.search.aggregations.bucket.filter;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class InternalFilter extends InternalSingleBucketAggregation implements Filter { public class InternalFilter extends InternalSingleBucketAggregation implements Filter {
InternalFilter(String name, long docCount, InternalAggregations subAggregations, List<PipelineAggregator> pipelineAggregators, InternalFilter(String name, long docCount, InternalAggregations subAggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, subAggregations, metadata);
super(name, docCount, subAggregations, pipelineAggregators, metadata);
} }
/** /**
@ -48,6 +45,6 @@ public class InternalFilter extends InternalSingleBucketAggregation implements F
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalFilter(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalFilter(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -49,8 +48,8 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends Bucke
GeoGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource, GeoGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
int requiredSize, int shardSize, SearchContext aggregationContext, int requiredSize, int shardSize, SearchContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Aggregator parent, Map<String, Object> metadata) throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata); super(name, factories, aggregationContext, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.requiredSize = requiredSize; this.requiredSize = requiredSize;
this.shardSize = shardSize; this.shardSize = shardSize;

View File

@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -35,10 +34,8 @@ public class GeoHashGridAggregator extends GeoGridAggregator<InternalGeoHashGrid
GeoHashGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource, GeoHashGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
int requiredSize, int shardSize, SearchContext aggregationContext, int requiredSize, int shardSize, SearchContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent, metadata);
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent,
pipelineAggregators, metadata);
} }
@Override @Override

View File

@ -27,14 +27,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -60,10 +58,9 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, emptyList(), metadata); final InternalAggregation aggregation = new InternalGeoHashGrid(name, requiredSize, emptyList(), metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;
@ -76,13 +73,12 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, Geohash::longEncode); CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, Geohash::longEncode);
return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize, return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize,
searchContext, parent, pipelineAggregators, metadata); searchContext, parent, metadata);
} }
} }

View File

@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
@ -36,10 +35,8 @@ public class GeoTileGridAggregator extends GeoGridAggregator<InternalGeoTileGrid
GeoTileGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource, GeoTileGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
int requiredSize, int shardSize, SearchContext aggregationContext, int requiredSize, int shardSize, SearchContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent, metadata);
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent,
pipelineAggregators, metadata);
} }
@Override @Override

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
@ -34,7 +33,6 @@ import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
import java.util.List;
import java.util.Map; import java.util.Map;
public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> { public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> {
@ -58,10 +56,9 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata); final InternalAggregation aggregation = new InternalGeoTileGrid(name, requiredSize, Collections.emptyList(), metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;
@ -74,13 +71,12 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, GeoTileUtils::longEncode); CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, GeoTileUtils::longEncode);
return new GeoTileGridAggregator(name, factories, cellIdSource, requiredSize, shardSize, return new GeoTileGridAggregator(name, factories, cellIdSource, requiredSize, shardSize,
searchContext, parent, pipelineAggregators, metadata); searchContext, parent, metadata);
} }
} }

View File

@ -25,18 +25,16 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class GlobalAggregator extends BucketsAggregator implements SingleBucketAggregator { public class GlobalAggregator extends BucketsAggregator implements SingleBucketAggregator {
public GlobalAggregator(String name, AggregatorFactories subFactories, SearchContext aggregationContext, public GlobalAggregator(String name, AggregatorFactories subFactories, SearchContext aggregationContext,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, subFactories, aggregationContext, null, pipelineAggregators, metadata); super(name, subFactories, aggregationContext, null, metadata);
} }
@Override @Override
@ -54,8 +52,7 @@ public class GlobalAggregator extends BucketsAggregator implements SingleBucketA
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
assert owningBucketOrdinal == 0 : "global aggregator can only be a top level aggregator"; assert owningBucketOrdinal == 0 : "global aggregator can only be a top level aggregator";
return new InternalGlobal(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(), return new InternalGlobal(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
metadata());
} }
@Override @Override

View File

@ -24,11 +24,9 @@ import org.elasticsearch.search.aggregations.AggregationExecutionException;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class GlobalAggregatorFactory extends AggregatorFactory { public class GlobalAggregatorFactory extends AggregatorFactory {
@ -45,7 +43,6 @@ public class GlobalAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (parent != null) { if (parent != null) {
throw new AggregationExecutionException("Aggregation [" + parent.name() + "] cannot have a global " + "sub-aggregation [" + name throw new AggregationExecutionException("Aggregation [" + parent.name() + "] cannot have a global " + "sub-aggregation [" + name
@ -54,6 +51,6 @@ public class GlobalAggregatorFactory extends AggregatorFactory {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
throw new IllegalStateException(); throw new IllegalStateException();
} }
return new GlobalAggregator(name, factories, searchContext, pipelineAggregators, metadata); return new GlobalAggregator(name, factories, searchContext, metadata);
} }
} }

View File

@ -21,10 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.global;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -32,9 +30,8 @@ import java.util.Map;
* regardless the query. * regardless the query.
*/ */
public class InternalGlobal extends InternalSingleBucketAggregation implements Global { public class InternalGlobal extends InternalSingleBucketAggregation implements Global {
InternalGlobal(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators, InternalGlobal(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -51,6 +48,6 @@ public class InternalGlobal extends InternalSingleBucketAggregation implements G
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalGlobal(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalGlobal(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector; import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector;
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo; import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -66,9 +65,9 @@ class AutoDateHistogramAggregator extends DeferableBucketAggregator {
AutoDateHistogramAggregator(String name, AggregatorFactories factories, int numBuckets, RoundingInfo[] roundingInfos, AutoDateHistogramAggregator(String name, AggregatorFactories factories, int numBuckets, RoundingInfo[] roundingInfos,
@Nullable ValuesSource.Numeric valuesSource, DocValueFormat formatter, SearchContext aggregationContext, Aggregator parent, @Nullable ValuesSource.Numeric valuesSource, DocValueFormat formatter, SearchContext aggregationContext, Aggregator parent,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata); super(name, factories, aggregationContext, parent, metadata);
this.targetBuckets = numBuckets; this.targetBuckets = numBuckets;
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.formatter = formatter; this.formatter = formatter;
@ -185,16 +184,14 @@ class AutoDateHistogramAggregator extends DeferableBucketAggregator {
InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx, InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx,
buildEmptySubAggregations()); buildEmptySubAggregations());
return new InternalAutoDateHistogram(name, buckets, targetBuckets, emptyBucketInfo, return new InternalAutoDateHistogram(name, buckets, targetBuckets, emptyBucketInfo, formatter, metadata(), 1);
formatter, pipelineAggregators(), metadata(), 1);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx, InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx,
buildEmptySubAggregations()); buildEmptySubAggregations());
return new InternalAutoDateHistogram(name, Collections.emptyList(), targetBuckets, emptyBucketInfo, formatter, return new InternalAutoDateHistogram(name, Collections.emptyList(), targetBuckets, emptyBucketInfo, formatter, metadata(), 1);
pipelineAggregators(), metadata(), 1);
} }
@Override @Override

View File

@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo; import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
@ -32,7 +31,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public final class AutoDateHistogramAggregatorFactory public final class AutoDateHistogramAggregatorFactory
@ -59,28 +57,25 @@ public final class AutoDateHistogramAggregatorFactory
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
return createAggregator(valuesSource, searchContext, parent, pipelineAggregators, metadata); return createAggregator(valuesSource, searchContext, parent, metadata);
} }
private Aggregator createAggregator(ValuesSource.Numeric valuesSource, private Aggregator createAggregator(ValuesSource.Numeric valuesSource,
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new AutoDateHistogramAggregator(name, factories, numBuckets, roundingInfos, return new AutoDateHistogramAggregator(name, factories, numBuckets, roundingInfos,
valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata); valuesSource, config.format(), searchContext, parent, metadata);
} }
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return createAggregator(null, searchContext, parent, pipelineAggregators, metadata); return createAggregator(null, searchContext, parent, metadata);
} }
} }

View File

@ -34,7 +34,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -68,9 +67,9 @@ class DateHistogramAggregator extends BucketsAggregator {
BucketOrder order, boolean keyed, BucketOrder order, boolean keyed,
long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Numeric valuesSource, long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Numeric valuesSource,
DocValueFormat formatter, SearchContext aggregationContext, DocValueFormat formatter, SearchContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Aggregator parent, Map<String, Object> metadata) throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata); super(name, factories, aggregationContext, parent, metadata);
this.rounding = rounding; this.rounding = rounding;
this.shardRounding = shardRounding; this.shardRounding = shardRounding;
this.order = order; this.order = order;

View File

@ -26,18 +26,15 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public final class DateHistogramAggregatorFactory public final class DateHistogramAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
extends ValuesSourceAggregatorFactory<ValuesSource> {
private final BucketOrder order; private final BucketOrder order;
private final boolean keyed; private final boolean keyed;
@ -78,20 +75,19 @@ public final class DateHistogramAggregatorFactory
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
if (valuesSource instanceof ValuesSource.Numeric) { if (valuesSource instanceof ValuesSource.Numeric) {
return createAggregator((ValuesSource.Numeric) valuesSource, searchContext, parent, pipelineAggregators, metadata); return createAggregator((ValuesSource.Numeric) valuesSource, searchContext, parent, metadata);
} else if (valuesSource instanceof ValuesSource.Range) { } else if (valuesSource instanceof ValuesSource.Range) {
ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource; ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource;
if (rangeValueSource.rangeType() != RangeType.DATE) { if (rangeValueSource.rangeType() != RangeType.DATE) {
throw new IllegalArgumentException("Expected date range type but found range type [" + rangeValueSource.rangeType().name throw new IllegalArgumentException("Expected date range type but found range type [" + rangeValueSource.rangeType().name
+ "]"); + "]");
} }
return createRangeAggregator((ValuesSource.Range) valuesSource, searchContext, parent, pipelineAggregators, metadata); return createRangeAggregator((ValuesSource.Range) valuesSource, searchContext, parent, metadata);
} }
else { else {
throw new IllegalArgumentException("Expected one of [Date, Range] values source, found [" throw new IllegalArgumentException("Expected one of [Date, Range] values source, found ["
@ -100,26 +96,23 @@ public final class DateHistogramAggregatorFactory
} }
private Aggregator createAggregator(ValuesSource.Numeric valuesSource, SearchContext searchContext, private Aggregator createAggregator(ValuesSource.Numeric valuesSource, SearchContext searchContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException {
return new DateHistogramAggregator(name, factories, rounding, shardRounding, order, keyed, minDocCount, extendedBounds, return new DateHistogramAggregator(name, factories, rounding, shardRounding, order, keyed, minDocCount, extendedBounds,
valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata); valuesSource, config.format(), searchContext, parent, metadata);
} }
private Aggregator createRangeAggregator(ValuesSource.Range valuesSource, private Aggregator createRangeAggregator(ValuesSource.Range valuesSource,
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new DateRangeHistogramAggregator(name, factories, rounding, shardRounding, order, keyed, minDocCount, extendedBounds, return new DateRangeHistogramAggregator(name, factories, rounding, shardRounding, order, keyed, minDocCount, extendedBounds,
valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata); valuesSource, config.format(), searchContext, parent, metadata);
} }
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return createAggregator(null, searchContext, parent, pipelineAggregators, metadata); return createAggregator(null, searchContext, parent, metadata);
} }
} }

View File

@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -71,10 +70,9 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
BucketOrder order, boolean keyed, BucketOrder order, boolean keyed,
long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Range valuesSource, long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Range valuesSource,
DocValueFormat formatter, SearchContext aggregationContext, DocValueFormat formatter, SearchContext aggregationContext,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException {
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata); super(name, factories, aggregationContext, parent, metadata);
this.rounding = rounding; this.rounding = rounding;
this.shardRounding = shardRounding; this.shardRounding = shardRounding;
this.order = order; this.order = order;

View File

@ -24,14 +24,12 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -87,14 +85,13 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
if (valuesSource instanceof ValuesSource.Numeric) { if (valuesSource instanceof ValuesSource.Numeric) {
return new NumericHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound, return new NumericHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound,
(ValuesSource.Numeric) valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata); (ValuesSource.Numeric) valuesSource, config.format(), searchContext, parent, metadata);
} else if (valuesSource instanceof ValuesSource.Range) { } else if (valuesSource instanceof ValuesSource.Range) {
ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource; ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource;
if (rangeValueSource.rangeType().isNumeric() == false) { if (rangeValueSource.rangeType().isNumeric() == false) {
@ -102,8 +99,7 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
+ rangeValueSource.rangeType().name + "]"); + rangeValueSource.rangeType().name + "]");
} }
return new RangeHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound, return new RangeHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound,
(ValuesSource.Range) valuesSource, config.format(), searchContext, parent, pipelineAggregators, (ValuesSource.Range) valuesSource, config.format(), searchContext, parent, metadata);
metadata);
} }
else { else {
throw new IllegalArgumentException("Expected one of [Numeric, Range] values source, found [" throw new IllegalArgumentException("Expected one of [Numeric, Range] values source, found ["
@ -114,9 +110,8 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new NumericHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound, return new NumericHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound,
null, config.format(), searchContext, parent, pipelineAggregators, metadata); null, config.format(), searchContext, parent, metadata);
} }
} }

View File

@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation; import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo; import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.time.Instant; import java.time.Instant;
@ -200,8 +199,8 @@ public final class InternalAutoDateHistogram extends
private long bucketInnerInterval; private long bucketInnerInterval;
InternalAutoDateHistogram(String name, List<Bucket> buckets, int targetBuckets, BucketInfo emptyBucketInfo, DocValueFormat formatter, InternalAutoDateHistogram(String name, List<Bucket> buckets, int targetBuckets, BucketInfo emptyBucketInfo, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, long bucketInnerInterval) { Map<String, Object> metadata, long bucketInnerInterval) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.buckets = buckets; this.buckets = buckets;
this.bucketInfo = emptyBucketInfo; this.bucketInfo = emptyBucketInfo;
this.format = formatter; this.format = formatter;
@ -259,7 +258,7 @@ public final class InternalAutoDateHistogram extends
@Override @Override
public InternalAutoDateHistogram create(List<Bucket> buckets) { public InternalAutoDateHistogram create(List<Bucket> buckets) {
return new InternalAutoDateHistogram(name, buckets, targetBuckets, bucketInfo, format, pipelineAggregators(), metadata, 1); return new InternalAutoDateHistogram(name, buckets, targetBuckets, bucketInfo, format, metadata, 1);
} }
@Override @Override
@ -517,7 +516,7 @@ public final class InternalAutoDateHistogram extends
this.bucketInfo.emptySubAggregations); this.bucketInfo.emptySubAggregations);
return new InternalAutoDateHistogram(getName(), reducedBucketsResult.buckets, targetBuckets, bucketInfo, format, return new InternalAutoDateHistogram(getName(), reducedBucketsResult.buckets, targetBuckets, bucketInfo, format,
pipelineAggregators(), getMetadata(), reducedBucketsResult.innerInterval); getMetadata(), reducedBucketsResult.innerInterval);
} }
private BucketReduceResult maybeMergeConsecutiveBuckets(BucketReduceResult reducedBucketsResult, private BucketReduceResult maybeMergeConsecutiveBuckets(BucketReduceResult reducedBucketsResult,
@ -594,7 +593,7 @@ public final class InternalAutoDateHistogram extends
buckets2.add((Bucket) b); buckets2.add((Bucket) b);
} }
buckets2 = Collections.unmodifiableList(buckets2); buckets2 = Collections.unmodifiableList(buckets2);
return new InternalAutoDateHistogram(name, buckets2, targetBuckets, bucketInfo, format, pipelineAggregators(), getMetadata(), 1); return new InternalAutoDateHistogram(name, buckets2, targetBuckets, bucketInfo, format, getMetadata(), 1);
} }
@Override @Override

View File

@ -35,7 +35,6 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram.EmptyBucketInfo; import org.elasticsearch.search.aggregations.bucket.histogram.InternalHistogram.EmptyBucketInfo;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -66,10 +65,9 @@ class NumericHistogramAggregator extends BucketsAggregator {
NumericHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset, NumericHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset,
BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound, BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound,
@Nullable ValuesSource.Numeric valuesSource, DocValueFormat formatter, @Nullable ValuesSource.Numeric valuesSource, DocValueFormat formatter,
SearchContext context, Aggregator parent, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
if (interval <= 0) { if (interval <= 0) {
throw new IllegalArgumentException("interval must be positive, got: " + interval); throw new IllegalArgumentException("interval must be positive, got: " + interval);
} }

View File

@ -36,7 +36,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -60,10 +59,9 @@ public class RangeHistogramAggregator extends BucketsAggregator {
RangeHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset, RangeHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset,
BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound, BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound,
@Nullable ValuesSource.Range valuesSource, DocValueFormat formatter, @Nullable ValuesSource.Range valuesSource, DocValueFormat formatter,
SearchContext context, Aggregator parent, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
if (interval <= 0) { if (interval <= 0) {
throw new IllegalArgumentException("interval must be positive, got: " + interval); throw new IllegalArgumentException("interval must be positive, got: " + interval);
} }

View File

@ -21,16 +21,13 @@ package org.elasticsearch.search.aggregations.bucket.missing;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class InternalMissing extends InternalSingleBucketAggregation implements Missing { public class InternalMissing extends InternalSingleBucketAggregation implements Missing {
InternalMissing(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators, InternalMissing(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -47,6 +44,6 @@ public class InternalMissing extends InternalSingleBucketAggregation implements
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalMissing(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalMissing(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -27,12 +27,10 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class MissingAggregator extends BucketsAggregator implements SingleBucketAggregator { public class MissingAggregator extends BucketsAggregator implements SingleBucketAggregator {
@ -40,9 +38,8 @@ public class MissingAggregator extends BucketsAggregator implements SingleBucket
private final ValuesSource valuesSource; private final ValuesSource valuesSource;
public MissingAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource, public MissingAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource,
SearchContext aggregationContext, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext aggregationContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, aggregationContext, parent, metadata);
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
} }
@ -72,13 +69,12 @@ public class MissingAggregator extends BucketsAggregator implements SingleBucket
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
pipelineAggregators(), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalMissing(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalMissing(name, 0, buildEmptySubAggregations(), metadata());
} }
} }

View File

@ -23,14 +23,12 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> { public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
@ -43,9 +41,8 @@ public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<Valu
@Override @Override
protected MissingAggregator createUnmapped(SearchContext searchContext, protected MissingAggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new MissingAggregator(name, factories, null, searchContext, parent, pipelineAggregators, metadata); return new MissingAggregator(name, factories, null, searchContext, parent, metadata);
} }
@Override @Override
@ -53,9 +50,8 @@ public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<Valu
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new MissingAggregator(name, factories, valuesSource, searchContext, parent, pipelineAggregators, metadata); return new MissingAggregator(name, factories, valuesSource, searchContext, parent, metadata);
} }
} }

View File

@ -21,19 +21,16 @@ package org.elasticsearch.search.aggregations.bucket.nested;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Result of the {@link NestedAggregator}. * Result of the {@link NestedAggregator}.
*/ */
public class InternalNested extends InternalSingleBucketAggregation implements Nested { public class InternalNested extends InternalSingleBucketAggregation implements Nested {
InternalNested(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators, InternalNested(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -50,6 +47,6 @@ public class InternalNested extends InternalSingleBucketAggregation implements N
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalNested(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalNested(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -21,19 +21,16 @@ package org.elasticsearch.search.aggregations.bucket.nested;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* Result of the {@link ReverseNestedAggregator}. * Result of the {@link ReverseNestedAggregator}.
*/ */
public class InternalReverseNested extends InternalSingleBucketAggregation implements ReverseNested { public class InternalReverseNested extends InternalSingleBucketAggregation implements ReverseNested {
public InternalReverseNested(String name, long docCount, InternalAggregations aggregations, public InternalReverseNested(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, docCount, aggregations, metadata);
super(name, docCount, aggregations, pipelineAggregators, metadata);
} }
/** /**
@ -50,6 +47,6 @@ public class InternalReverseNested extends InternalSingleBucketAggregation imple
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) { protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
return new InternalReverseNested(name, docCount, subAggregations, pipelineAggregators(), getMetadata()); return new InternalReverseNested(name, docCount, subAggregations, getMetadata());
} }
} }

View File

@ -42,11 +42,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class NestedAggregator extends BucketsAggregator implements SingleBucketAggregator { public class NestedAggregator extends BucketsAggregator implements SingleBucketAggregator {
@ -61,9 +59,8 @@ public class NestedAggregator extends BucketsAggregator implements SingleBucketA
NestedAggregator(String name, AggregatorFactories factories, ObjectMapper parentObjectMapper, ObjectMapper childObjectMapper, NestedAggregator(String name, AggregatorFactories factories, ObjectMapper parentObjectMapper, ObjectMapper childObjectMapper,
SearchContext context, Aggregator parentAggregator, SearchContext context, Aggregator parentAggregator,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, Map<String, Object> metadata, boolean collectsFromSingleBucket) throws IOException {
boolean collectsFromSingleBucket) throws IOException { super(name, factories, context, parentAggregator, metadata);
super(name, factories, context, parentAggregator, pipelineAggregators, metadata);
Query parentFilter = parentObjectMapper != null ? parentObjectMapper.nestedTypeFilter() Query parentFilter = parentObjectMapper != null ? parentObjectMapper.nestedTypeFilter()
: Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated()); : Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated());
@ -126,13 +123,12 @@ public class NestedAggregator extends BucketsAggregator implements SingleBucketA
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), return new InternalNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
pipelineAggregators(), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalNested(name, 0, buildEmptySubAggregations(), metadata());
} }
class BufferingNestedLeafBucketCollector extends LeafBucketCollectorBase { class BufferingNestedLeafBucketCollector extends LeafBucketCollectorBase {

View File

@ -26,11 +26,9 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class NestedAggregatorFactory extends AggregatorFactory { public class NestedAggregatorFactory extends AggregatorFactory {
@ -50,13 +48,12 @@ public class NestedAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (childObjectMapper == null) { if (childObjectMapper == null) {
return new Unmapped(name, searchContext, parent, pipelineAggregators, metadata); return new Unmapped(name, searchContext, parent, metadata);
} }
return new NestedAggregator(name, factories, parentObjectMapper, childObjectMapper, searchContext, parent, return new NestedAggregator(name, factories, parentObjectMapper, childObjectMapper, searchContext, parent,
pipelineAggregators, metadata, collectsFromSingleBucket); metadata, collectsFromSingleBucket);
} }
private static final class Unmapped extends NonCollectingAggregator { private static final class Unmapped extends NonCollectingAggregator {
@ -64,14 +61,13 @@ public class NestedAggregatorFactory extends AggregatorFactory {
Unmapped(String name, Unmapped(String name,
SearchContext context, SearchContext context,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalNested(name, 0, buildEmptySubAggregations(), metadata());
} }
} }

View File

@ -35,11 +35,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ReverseNestedAggregator extends BucketsAggregator implements SingleBucketAggregator { public class ReverseNestedAggregator extends BucketsAggregator implements SingleBucketAggregator {
@ -50,9 +48,9 @@ public class ReverseNestedAggregator extends BucketsAggregator implements Single
private final BitSetProducer parentBitsetProducer; private final BitSetProducer parentBitsetProducer;
public ReverseNestedAggregator(String name, AggregatorFactories factories, ObjectMapper objectMapper, public ReverseNestedAggregator(String name, AggregatorFactories factories, ObjectMapper objectMapper,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) SearchContext context, Aggregator parent, Map<String, Object> metadata)
throws IOException { throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
if (objectMapper == null) { if (objectMapper == null) {
parentFilter = Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated()); parentFilter = Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated());
} else { } else {
@ -94,13 +92,12 @@ public class ReverseNestedAggregator extends BucketsAggregator implements Single
@Override @Override
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
pipelineAggregators(), metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalReverseNested(name, 0, buildEmptySubAggregations(), metadata());
} }
Query getParentFilter() { Query getParentFilter() {

View File

@ -26,11 +26,9 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class ReverseNestedAggregatorFactory extends AggregatorFactory { public class ReverseNestedAggregatorFactory extends AggregatorFactory {
@ -51,13 +49,12 @@ public class ReverseNestedAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (unmapped) { if (unmapped) {
return new Unmapped(name, searchContext, parent, pipelineAggregators, metadata); return new Unmapped(name, searchContext, parent, metadata);
} else { } else {
return new ReverseNestedAggregator(name, factories, parentObjectMapper, return new ReverseNestedAggregator(name, factories, parentObjectMapper,
searchContext, parent, pipelineAggregators, metadata); searchContext, parent, metadata);
} }
} }
@ -66,14 +63,13 @@ public class ReverseNestedAggregatorFactory extends AggregatorFactory {
Unmapped(String name, Unmapped(String name,
SearchContext context, SearchContext context,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalReverseNested(name, 0, buildEmptySubAggregations(), metadata());
} }
} }
} }

View File

@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range;
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Unmapped; import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Unmapped;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
@ -33,7 +32,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> { public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> {
@ -60,9 +58,8 @@ public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourc
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new Unmapped<>(name, ranges, keyed, config.format(), searchContext, parent, rangeFactory, pipelineAggregators, metadata); return new Unmapped<>(name, ranges, keyed, config.format(), searchContext, parent, rangeFactory, metadata);
} }
@Override @Override
@ -70,10 +67,9 @@ public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourc
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new RangeAggregator(name, factories, valuesSource, config.format(), rangeFactory, ranges, keyed, searchContext, parent, return new RangeAggregator(name, factories, valuesSource, config.format(), rangeFactory, ranges, keyed, searchContext, parent,
pipelineAggregators, metadata); metadata);
} }

View File

@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -80,9 +79,8 @@ public final class BinaryRangeAggregator extends BucketsAggregator {
public BinaryRangeAggregator(String name, AggregatorFactories factories, public BinaryRangeAggregator(String name, AggregatorFactories factories,
ValuesSource.Bytes valuesSource, DocValueFormat format, ValuesSource.Bytes valuesSource, DocValueFormat format,
List<Range> ranges, boolean keyed, SearchContext context, List<Range> ranges, boolean keyed, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, context, parent, metadata);
super(name, factories, context, parent, pipelineAggregators, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.format = format; this.format = format;
this.keyed = keyed; this.keyed = keyed;
@ -337,11 +335,11 @@ public final class BinaryRangeAggregator extends BucketsAggregator {
ranges[i].key, ranges[i].from, ranges[i].to, ranges[i].key, ranges[i].from, ranges[i].to,
bucketDocCount(bucketOrd), bucketAggregations(bucketOrd))); bucketDocCount(bucketOrd), bucketAggregations(bucketOrd)));
} }
return new InternalBinaryRange(name, format, keyed, buckets, pipelineAggregators(), metadata()); return new InternalBinaryRange(name, format, keyed, buckets, metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalBinaryRange(name, format, keyed, emptyList(), pipelineAggregators(), metadata()); return new InternalBinaryRange(name, format, keyed, emptyList(), metadata());
} }
} }

View File

@ -22,7 +22,6 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder; import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
@ -50,21 +49,18 @@ public class BinaryRangeAggregatorFactory
} }
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException {
return new BinaryRangeAggregator(name, factories, null, config.format(), return new BinaryRangeAggregator(name, factories, null, config.format(),
ranges, keyed, searchContext, parent, pipelineAggregators, metadata); ranges, keyed, searchContext, parent, metadata);
} }
@Override @Override
protected Aggregator doCreateInternal(ValuesSource.Bytes valuesSource, protected Aggregator doCreateInternal(ValuesSource.Bytes valuesSource,
SearchContext searchContext, Aggregator parent, SearchContext searchContext, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new BinaryRangeAggregator(name, factories, valuesSource, config.format(), return new BinaryRangeAggregator(name, factories, valuesSource, config.format(),
ranges, keyed, searchContext, parent, pipelineAggregators, metadata); ranges, keyed, searchContext, parent, metadata);
} }
} }

View File

@ -33,14 +33,12 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.bucket.range.GeoDistanceAggregationBuilder.Range; import org.elasticsearch.search.aggregations.bucket.range.GeoDistanceAggregationBuilder.Range;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class GeoDistanceRangeAggregatorFactory public class GeoDistanceRangeAggregatorFactory
@ -67,10 +65,9 @@ public class GeoDistanceRangeAggregatorFactory
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new RangeAggregator.Unmapped<>(name, ranges, keyed, config.format(), searchContext, parent, return new RangeAggregator.Unmapped<>(name, ranges, keyed, config.format(), searchContext, parent,
rangeFactory, pipelineAggregators, metadata); rangeFactory, metadata);
} }
@Override @Override
@ -78,12 +75,10 @@ public class GeoDistanceRangeAggregatorFactory
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
DistanceSource distanceSource = new DistanceSource(valuesSource, distanceType, origin, unit); DistanceSource distanceSource = new DistanceSource(valuesSource, distanceType, origin, unit);
return new RangeAggregator(name, factories, distanceSource, config.format(), rangeFactory, ranges, keyed, searchContext, return new RangeAggregator(name, factories, distanceSource, config.format(), rangeFactory, ranges, keyed, searchContext,
parent, parent, metadata);
pipelineAggregators, metadata);
} }
private static class DistanceSource extends ValuesSource.Numeric { private static class DistanceSource extends ValuesSource.Numeric {

View File

@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -192,9 +191,8 @@ public final class InternalBinaryRange
protected final boolean keyed; protected final boolean keyed;
private final List<Bucket> buckets; private final List<Bucket> buckets;
public InternalBinaryRange(String name, DocValueFormat format, boolean keyed, List<Bucket> buckets, public InternalBinaryRange(String name, DocValueFormat format, boolean keyed, List<Bucket> buckets, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.format = format; this.format = format;
this.keyed = keyed; this.keyed = keyed;
this.buckets = buckets; this.buckets = buckets;
@ -229,7 +227,7 @@ public final class InternalBinaryRange
@Override @Override
public InternalBinaryRange create(List<Bucket> buckets) { public InternalBinaryRange create(List<Bucket> buckets) {
return new InternalBinaryRange(name, format, keyed, buckets, pipelineAggregators(), metadata); return new InternalBinaryRange(name, format, keyed, buckets, metadata);
} }
@Override @Override
@ -262,7 +260,7 @@ public final class InternalBinaryRange
buckets.add(new Bucket(format, keyed, b.key, b.from, b.to, docCounts[i], buckets.add(new Bucket(format, keyed, b.key, b.from, b.to, docCounts[i],
InternalAggregations.reduce(Arrays.asList(aggs[i]), reduceContext))); InternalAggregations.reduce(Arrays.asList(aggs[i]), reduceContext)));
} }
return new InternalBinaryRange(name, format, keyed, buckets, pipelineAggregators(), metadata); return new InternalBinaryRange(name, format, keyed, buckets, metadata);
} }
@Override @Override

View File

@ -38,7 +38,6 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator; import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -227,9 +226,9 @@ public class RangeAggregator extends BucketsAggregator {
public RangeAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format, public RangeAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format,
InternalRange.Factory rangeFactory, Range[] ranges, boolean keyed, SearchContext context, InternalRange.Factory rangeFactory, Range[] ranges, boolean keyed, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Aggregator parent, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
assert valuesSource != null; assert valuesSource != null;
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.format = format; this.format = format;
@ -363,10 +362,10 @@ public class RangeAggregator extends BucketsAggregator {
private final DocValueFormat format; private final DocValueFormat format;
public Unmapped(String name, R[] ranges, boolean keyed, DocValueFormat format, SearchContext context, Aggregator parent, public Unmapped(String name, R[] ranges, boolean keyed, DocValueFormat format, SearchContext context, Aggregator parent,
InternalRange.Factory factory, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) InternalRange.Factory factory, Map<String, Object> metadata)
throws IOException { throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
this.ranges = ranges; this.ranges = ranges;
this.keyed = keyed; this.keyed = keyed;
this.format = format; this.format = format;

View File

@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregator.ExecutionMode; import org.elasticsearch.search.aggregations.bucket.sampler.SamplerAggregator.ExecutionMode;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
@ -35,7 +34,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> { public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
@ -58,11 +56,10 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (valuesSource instanceof ValuesSource.Numeric) { if (valuesSource instanceof ValuesSource.Numeric) {
return new DiversifiedNumericSamplerAggregator(name, shardSize, factories, searchContext, parent, pipelineAggregators, metadata, return new DiversifiedNumericSamplerAggregator(name, shardSize, factories, searchContext, parent, metadata,
(Numeric) valuesSource, maxDocsPerValue); (Numeric) valuesSource, maxDocsPerValue);
} }
@ -80,8 +77,7 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
if ((execution.needsGlobalOrdinals()) && (!(valuesSource instanceof ValuesSource.Bytes.WithOrdinals))) { if ((execution.needsGlobalOrdinals()) && (!(valuesSource instanceof ValuesSource.Bytes.WithOrdinals))) {
execution = ExecutionMode.MAP; execution = ExecutionMode.MAP;
} }
return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, searchContext, parent, pipelineAggregators, return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, searchContext, parent, metadata);
metadata);
} }
throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field() throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field()
@ -91,11 +87,10 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final UnmappedSampler aggregation = new UnmappedSampler(name, pipelineAggregators, metadata); final UnmappedSampler aggregation = new UnmappedSampler(name, metadata);
return new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, factories, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;

View File

@ -31,12 +31,10 @@ import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -50,10 +48,10 @@ public class DiversifiedBytesHashSamplerAggregator extends SamplerAggregator {
private int maxDocsPerValue; private int maxDocsPerValue;
DiversifiedBytesHashSamplerAggregator(String name, int shardSize, AggregatorFactories factories, DiversifiedBytesHashSamplerAggregator(String name, int shardSize, AggregatorFactories factories,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, SearchContext context, Aggregator parent, Map<String, Object> metadata,
ValuesSource valuesSource, ValuesSource valuesSource,
int maxDocsPerValue) throws IOException { int maxDocsPerValue) throws IOException {
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata); super(name, shardSize, factories, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.maxDocsPerValue = maxDocsPerValue; this.maxDocsPerValue = maxDocsPerValue;
} }

View File

@ -33,12 +33,10 @@ import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -49,9 +47,9 @@ public class DiversifiedMapSamplerAggregator extends SamplerAggregator {
private BytesRefHash bucketOrds; private BytesRefHash bucketOrds;
DiversifiedMapSamplerAggregator(String name, int shardSize, AggregatorFactories factories, DiversifiedMapSamplerAggregator(String name, int shardSize, AggregatorFactories factories,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, SearchContext context, Aggregator parent, Map<String, Object> metadata,
ValuesSource valuesSource, int maxDocsPerValue) throws IOException { ValuesSource valuesSource, int maxDocsPerValue) throws IOException {
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata); super(name, shardSize, factories, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.maxDocsPerValue = maxDocsPerValue; this.maxDocsPerValue = maxDocsPerValue;
// Need to use super class shardSize since it is limited to maxDoc // Need to use super class shardSize since it is limited to maxDoc

View File

@ -30,12 +30,10 @@ import org.elasticsearch.index.fielddata.AbstractNumericDocValues;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -45,9 +43,9 @@ public class DiversifiedNumericSamplerAggregator extends SamplerAggregator {
private int maxDocsPerValue; private int maxDocsPerValue;
DiversifiedNumericSamplerAggregator(String name, int shardSize, AggregatorFactories factories, DiversifiedNumericSamplerAggregator(String name, int shardSize, AggregatorFactories factories,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, SearchContext context, Aggregator parent, Map<String, Object> metadata,
ValuesSource.Numeric valuesSource, int maxDocsPerValue) throws IOException { ValuesSource.Numeric valuesSource, int maxDocsPerValue) throws IOException {
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata); super(name, shardSize, factories, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.maxDocsPerValue = maxDocsPerValue; this.maxDocsPerValue = maxDocsPerValue;
} }

View File

@ -31,12 +31,10 @@ import org.elasticsearch.index.fielddata.AbstractNumericDocValues;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -46,9 +44,9 @@ public class DiversifiedOrdinalsSamplerAggregator extends SamplerAggregator {
private int maxDocsPerValue; private int maxDocsPerValue;
DiversifiedOrdinalsSamplerAggregator(String name, int shardSize, AggregatorFactories factories, DiversifiedOrdinalsSamplerAggregator(String name, int shardSize, AggregatorFactories factories,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, SearchContext context, Aggregator parent, Map<String, Object> metadata,
ValuesSource.Bytes.WithOrdinals.FieldData valuesSource, int maxDocsPerValue) throws IOException { ValuesSource.Bytes.WithOrdinals.FieldData valuesSource, int maxDocsPerValue) throws IOException {
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata); super(name, shardSize, factories, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.maxDocsPerValue = maxDocsPerValue; this.maxDocsPerValue = maxDocsPerValue;
} }

View File

@ -21,10 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.sampler;
import org.elasticsearch.common.io.stream.StreamInput; import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation; import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class InternalSampler extends InternalSingleBucketAggregation implements Sampler { public class InternalSampler extends InternalSingleBucketAggregation implements Sampler {
@ -32,9 +30,8 @@ public class InternalSampler extends InternalSingleBucketAggregation implements
// InternalSampler and UnmappedSampler share the same parser name, so we use this when identifying the aggregation type // InternalSampler and UnmappedSampler share the same parser name, so we use this when identifying the aggregation type
public static final String PARSER_NAME = "sampler"; public static final String PARSER_NAME = "sampler";
InternalSampler(String name, long docCount, InternalAggregations subAggregations, List<PipelineAggregator> pipelineAggregators, InternalSampler(String name, long docCount, InternalAggregations subAggregations, Map<String, Object> metadata) {
Map<String, Object> metadata) { super(name, docCount, subAggregations, metadata);
super(name, docCount, subAggregations, pipelineAggregators, metadata);
} }
/** /**
@ -57,6 +54,6 @@ public class InternalSampler extends InternalSingleBucketAggregation implements
@Override @Override
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, protected InternalSingleBucketAggregation newAggregation(String name, long docCount,
InternalAggregations subAggregations) { InternalAggregations subAggregations) {
return new InternalSampler(name, docCount, subAggregations, pipelineAggregators(), metadata); return new InternalSampler(name, docCount, subAggregations, metadata);
} }
} }

View File

@ -33,13 +33,11 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator; import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator; import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -66,10 +64,9 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
@Override @Override
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource, Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException {
return new DiversifiedMapSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, metadata, return new DiversifiedMapSamplerAggregator(name, shardSize, factories, context, parent, metadata,
valuesSource, valuesSource,
maxDocsPerValue); maxDocsPerValue);
} }
@ -84,11 +81,9 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
@Override @Override
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource, Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException {
return new DiversifiedBytesHashSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, return new DiversifiedBytesHashSamplerAggregator(name, shardSize, factories, context, parent, metadata,
metadata,
valuesSource, valuesSource,
maxDocsPerValue); maxDocsPerValue);
} }
@ -103,9 +98,8 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
@Override @Override
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource, Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { return new DiversifiedOrdinalsSamplerAggregator(name, shardSize, factories, context, parent, metadata,
return new DiversifiedOrdinalsSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, metadata,
(ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, maxDocsPerValue); (ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, maxDocsPerValue);
} }
@ -132,8 +126,7 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
} }
abstract Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, abstract Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue,
ValuesSource valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, ValuesSource valuesSource, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException;
Map<String, Object> metadata) throws IOException;
abstract boolean needsGlobalOrdinals(); abstract boolean needsGlobalOrdinals();
@ -148,8 +141,8 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
protected BestDocsDeferringCollector bdd; protected BestDocsDeferringCollector bdd;
SamplerAggregator(String name, int shardSize, AggregatorFactories factories, SearchContext context, SamplerAggregator(String name, int shardSize, AggregatorFactories factories, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Aggregator parent, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
// Make sure we do not allow size > maxDoc, to prevent accidental OOM // Make sure we do not allow size > maxDoc, to prevent accidental OOM
this.shardSize = Math.min(shardSize, context.searcher().getIndexReader().maxDoc()); this.shardSize = Math.min(shardSize, context.searcher().getIndexReader().maxDoc());
} }
@ -174,13 +167,12 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException { public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
runDeferredCollections(owningBucketOrdinal); runDeferredCollections(owningBucketOrdinal);
return new InternalSampler(name, bdd == null ? 0 : bdd.getDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), return new InternalSampler(name, bdd == null ? 0 : bdd.getDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal),
pipelineAggregators(),
metadata()); metadata());
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new InternalSampler(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata()); return new InternalSampler(name, 0, buildEmptySubAggregations(), metadata());
} }
@Override @Override

View File

@ -23,11 +23,9 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class SamplerAggregatorFactory extends AggregatorFactory { public class SamplerAggregatorFactory extends AggregatorFactory {
@ -44,9 +42,8 @@ public class SamplerAggregatorFactory extends AggregatorFactory {
public Aggregator createInternal(SearchContext searchContext, public Aggregator createInternal(SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new SamplerAggregator(name, shardSize, factories, searchContext, parent, pipelineAggregators, metadata); return new SamplerAggregator(name, shardSize, factories, searchContext, parent, metadata);
} }
} }

View File

@ -23,7 +23,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -32,8 +31,8 @@ import java.util.Map;
public class UnmappedSampler extends InternalSampler { public class UnmappedSampler extends InternalSampler {
public static final String NAME = "unmapped_sampler"; public static final String NAME = "unmapped_sampler";
UnmappedSampler(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { UnmappedSampler(String name, Map<String, Object> metadata) {
super(name, 0, InternalAggregations.EMPTY, pipelineAggregators, metadata); super(name, 0, InternalAggregations.EMPTY, metadata);
} }
/** /**
@ -50,7 +49,7 @@ public class UnmappedSampler extends InternalSampler {
@Override @Override
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
return new UnmappedSampler(name, pipelineAggregators(), metadata); return new UnmappedSampler(name, metadata);
} }
@Override @Override

View File

@ -30,14 +30,12 @@ import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.GlobalOrdinalsStringTermsAggregator;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.ContextIndexSearcher; import org.elasticsearch.search.internal.ContextIndexSearcher;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -62,10 +60,9 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
boolean forceRemapGlobalOrds, boolean forceRemapGlobalOrds,
SignificanceHeuristic significanceHeuristic, SignificanceHeuristic significanceHeuristic,
SignificantTermsAggregatorFactory termsAggFactory, SignificantTermsAggregatorFactory termsAggFactory,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, valuesSource, null, format, bucketCountThresholds, includeExclude, context, parent, super(name, factories, valuesSource, null, format, bucketCountThresholds, includeExclude, context, parent,
forceRemapGlobalOrds, SubAggCollectionMode.BREADTH_FIRST, false, pipelineAggregators, metadata); forceRemapGlobalOrds, SubAggCollectionMode.BREADTH_FIRST, false, metadata);
this.significanceHeuristic = significanceHeuristic; this.significanceHeuristic = significanceHeuristic;
this.termsAggFactory = termsAggFactory; this.termsAggFactory = termsAggFactory;
this.numCollectedDocs = 0; this.numCollectedDocs = 0;

View File

@ -29,14 +29,12 @@ import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.bucket.terms.LongTermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.LongTermsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.ContextIndexSearcher; import org.elasticsearch.search.internal.ContextIndexSearcher;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -46,11 +44,10 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
public SignificantLongTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, public SignificantLongTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource,
DocValueFormat format, BucketCountThresholds bucketCountThresholds, SearchContext context, Aggregator parent, DocValueFormat format, BucketCountThresholds bucketCountThresholds, SearchContext context, Aggregator parent,
SignificanceHeuristic significanceHeuristic, SignificantTermsAggregatorFactory termsAggFactory, SignificanceHeuristic significanceHeuristic, SignificantTermsAggregatorFactory termsAggFactory,
IncludeExclude.LongFilter includeExclude, IncludeExclude.LongFilter includeExclude, Map<String, Object> metadata) throws IOException {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
super(name, factories, valuesSource, format, null, bucketCountThresholds, context, parent, super(name, factories, valuesSource, format, null, bucketCountThresholds, context, parent,
SubAggCollectionMode.BREADTH_FIRST, false, includeExclude, pipelineAggregators, metadata); SubAggCollectionMode.BREADTH_FIRST, false, includeExclude, metadata);
this.significanceHeuristic = significanceHeuristic; this.significanceHeuristic = significanceHeuristic;
this.termsAggFactory = termsAggFactory; this.termsAggFactory = termsAggFactory;
} }

View File

@ -30,14 +30,12 @@ import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic; import org.elasticsearch.search.aggregations.bucket.significant.heuristics.SignificanceHeuristic;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.StringTermsAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.ContextIndexSearcher; import org.elasticsearch.search.internal.ContextIndexSearcher;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -54,10 +52,10 @@ public class SignificantStringTermsAggregator extends StringTermsAggregator {
public SignificantStringTermsAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource, DocValueFormat format, public SignificantStringTermsAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource, DocValueFormat format,
BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude, SearchContext aggregationContext, BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude, SearchContext aggregationContext,
Aggregator parent, SignificanceHeuristic significanceHeuristic, SignificantTermsAggregatorFactory termsAggFactory, Aggregator parent, SignificanceHeuristic significanceHeuristic, SignificantTermsAggregatorFactory termsAggFactory,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, valuesSource, null, format, bucketCountThresholds, includeExclude, aggregationContext, parent, super(name, factories, valuesSource, null, format, bucketCountThresholds, includeExclude, aggregationContext, parent,
SubAggCollectionMode.BREADTH_FIRST, false, pipelineAggregators, metadata); SubAggCollectionMode.BREADTH_FIRST, false, metadata);
this.significanceHeuristic = significanceHeuristic; this.significanceHeuristic = significanceHeuristic;
this.termsAggFactory = termsAggFactory; this.termsAggFactory = termsAggFactory;
} }

View File

@ -49,14 +49,12 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.Signi
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource>
@ -164,11 +162,10 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(), final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(),
bucketCountThresholds.getMinDocCount(), metadata); bucketCountThresholds.getMinDocCount(), metadata);
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;
@ -181,7 +178,6 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
@ -226,7 +222,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
} }
return execution.create(name, factories, valuesSource, format, bucketCountThresholds, includeExclude, searchContext, parent, return execution.create(name, factories, valuesSource, format, bucketCountThresholds, includeExclude, searchContext, parent,
significanceHeuristic, this, pipelineAggregators, metadata); significanceHeuristic, this, metadata);
} }
if ((includeExclude != null) && (includeExclude.isRegexBased())) { if ((includeExclude != null) && (includeExclude.isRegexBased())) {
@ -245,8 +241,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
longFilter = includeExclude.convertToLongFilter(config.format()); longFilter = includeExclude.convertToLongFilter(config.format());
} }
return new SignificantLongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), return new SignificantLongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(),
bucketCountThresholds, searchContext, parent, significanceHeuristic, this, longFilter, pipelineAggregators, bucketCountThresholds, searchContext, parent, significanceHeuristic, this, longFilter, metadata);
metadata);
} }
throw new AggregationExecutionException("significant_terms aggregation cannot be applied to field [" throw new AggregationExecutionException("significant_terms aggregation cannot be applied to field ["
@ -268,12 +263,11 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
Aggregator parent, Aggregator parent,
SignificanceHeuristic significanceHeuristic, SignificanceHeuristic significanceHeuristic,
SignificantTermsAggregatorFactory termsAggregatorFactory, SignificantTermsAggregatorFactory termsAggregatorFactory,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format); final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
return new SignificantStringTermsAggregator(name, factories, valuesSource, format, bucketCountThresholds, filter, return new SignificantStringTermsAggregator(name, factories, valuesSource, format, bucketCountThresholds, filter,
aggregationContext, parent, significanceHeuristic, termsAggregatorFactory, pipelineAggregators, metadata); aggregationContext, parent, significanceHeuristic, termsAggregatorFactory, metadata);
} }
@ -291,7 +285,6 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
Aggregator parent, Aggregator parent,
SignificanceHeuristic significanceHeuristic, SignificanceHeuristic significanceHeuristic,
SignificantTermsAggregatorFactory termsAggregatorFactory, SignificantTermsAggregatorFactory termsAggregatorFactory,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format); final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format);
@ -309,8 +302,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
} }
return new GlobalOrdinalsSignificantTermsAggregator(name, factories, return new GlobalOrdinalsSignificantTermsAggregator(name, factories,
(ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, format, bucketCountThresholds, filter, (ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, format, bucketCountThresholds, filter,
aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, pipelineAggregators, aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, metadata);
metadata);
} }
}; };
@ -343,7 +335,6 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
Aggregator parent, Aggregator parent,
SignificanceHeuristic significanceHeuristic, SignificanceHeuristic significanceHeuristic,
SignificantTermsAggregatorFactory termsAggregatorFactory, SignificantTermsAggregatorFactory termsAggregatorFactory,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException; Map<String, Object> metadata) throws IOException;
@Override @Override

View File

@ -41,7 +41,6 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.Signi
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.StringFilter; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.StringFilter;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.ContextIndexSearcher; import org.elasticsearch.search.internal.ContextIndexSearcher;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import org.elasticsearch.search.lookup.SourceLookup; import org.elasticsearch.search.lookup.SourceLookup;
@ -72,12 +71,12 @@ public class SignificantTextAggregator extends BucketsAggregator {
public SignificantTextAggregator(String name, AggregatorFactories factories, public SignificantTextAggregator(String name, AggregatorFactories factories,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext context, Aggregator parent,
BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude, BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude,
SignificanceHeuristic significanceHeuristic, SignificantTextAggregatorFactory termsAggFactory, SignificanceHeuristic significanceHeuristic, SignificantTextAggregatorFactory termsAggFactory,
String fieldName, String [] sourceFieldNames, boolean filterDuplicateText, String fieldName, String [] sourceFieldNames, boolean filterDuplicateText,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
this.bucketCountThresholds = bucketCountThresholds; this.bucketCountThresholds = bucketCountThresholds;
this.includeExclude = includeExclude; this.includeExclude = includeExclude;
this.significanceHeuristic = significanceHeuristic; this.significanceHeuristic = significanceHeuristic;

View File

@ -43,11 +43,9 @@ import org.elasticsearch.search.aggregations.bucket.significant.heuristics.Signi
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class SignificantTextAggregatorFactory extends AggregatorFactory public class SignificantTextAggregatorFactory extends AggregatorFactory
@ -165,8 +163,7 @@ public class SignificantTextAggregatorFactory extends AggregatorFactory
@Override @Override
protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket, protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) Map<String, Object> metadata) throws IOException {
throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
} }
@ -191,7 +188,7 @@ public class SignificantTextAggregatorFactory extends AggregatorFactory
IncludeExclude.StringFilter incExcFilter = includeExclude == null ? null: IncludeExclude.StringFilter incExcFilter = includeExclude == null ? null:
includeExclude.convertToStringFilter(DocValueFormat.RAW); includeExclude.convertToStringFilter(DocValueFormat.RAW);
return new SignificantTextAggregator(name, factories, searchContext, parent, pipelineAggregators, bucketCountThresholds, return new SignificantTextAggregator(name, factories, searchContext, parent, bucketCountThresholds,
incExcFilter, significanceHeuristic, this, indexedFieldName, sourceFieldNames, filterDuplicateText, metadata); incExcFilter, significanceHeuristic, this, indexedFieldName, sourceFieldNames, filterDuplicateText, metadata);
} }

View File

@ -29,12 +29,10 @@ import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector; import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector; import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector;
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator; import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Random; import java.util.Random;
@ -53,10 +51,9 @@ public abstract class AbstractRareTermsAggregator<T extends ValuesSource,
final SetBackedScalingCuckooFilter filter; final SetBackedScalingCuckooFilter filter;
AbstractRareTermsAggregator(String name, AggregatorFactories factories, SearchContext context, AbstractRareTermsAggregator(String name, AggregatorFactories factories, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Aggregator parent, Map<String, Object> metadata, long maxDocCount, double precision,
Map<String, Object> metadata, long maxDocCount, double precision,
DocValueFormat format, T valuesSource, U includeExclude) throws IOException { DocValueFormat format, T valuesSource, U includeExclude) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
// We seed the rng with the ShardID so results are deterministic and don't change randomly // We seed the rng with the ShardID so results are deterministic and don't change randomly
this.filter = new SetBackedScalingCuckooFilter(10000, new Random(context.indexShard().shardId().hashCode()), precision); this.filter = new SetBackedScalingCuckooFilter(10000, new Random(context.indexShard().shardId().hashCode()), precision);

View File

@ -24,11 +24,9 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -39,8 +37,8 @@ abstract class AbstractStringTermsAggregator extends TermsAggregator {
AbstractStringTermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, AbstractStringTermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode subAggCollectMode, BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { boolean showTermDocCountError, Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators, metadata); super(name, factories, context, parent, bucketCountThresholds, order, format, subAggCollectMode, metadata);
this.showTermDocCountError = showTermDocCountError; this.showTermDocCountError = showTermDocCountError;
} }

View File

@ -26,7 +26,6 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -41,9 +40,9 @@ public class DoubleTermsAggregator extends LongTermsAggregator {
DoubleTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format, DoubleTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format,
BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent, BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent,
SubAggCollectionMode collectionMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter, SubAggCollectionMode collectionMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, valuesSource, format, order, bucketCountThresholds, aggregationContext, parent, collectionMode, super(name, factories, valuesSource, format, order, bucketCountThresholds, aggregationContext, parent, collectionMode,
showTermDocCountError, longFilter, pipelineAggregators, metadata); showTermDocCountError, longFilter, metadata);
} }
@Override @Override

View File

@ -41,13 +41,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.LongUnaryOperator; import java.util.function.LongUnaryOperator;
@ -88,10 +86,8 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
boolean remapGlobalOrds, boolean remapGlobalOrds,
SubAggCollectionMode collectionMode, SubAggCollectionMode collectionMode,
boolean showTermDocCountError, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata);
pipelineAggregators, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.includeExclude = includeExclude; this.includeExclude = includeExclude;
final IndexReader reader = context.searcher().getIndexReader(); final IndexReader reader = context.searcher().getIndexReader();
@ -312,10 +308,9 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
boolean forceDenseMode, boolean forceDenseMode,
SubAggCollectionMode collectionMode, SubAggCollectionMode collectionMode,
boolean showTermDocCountError, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, valuesSource, order, format, bucketCountThresholds, null, super(name, factories, valuesSource, order, format, bucketCountThresholds, null,
context, parent, forceDenseMode, collectionMode, showTermDocCountError, pipelineAggregators, metadata); context, parent, forceDenseMode, collectionMode, showTermDocCountError, metadata);
assert factories == null || factories.countAggregators() == 0; assert factories == null || factories.countAggregators() == 0;
this.segmentDocCounts = context.bigArrays().newIntArray(1, true); this.segmentDocCounts = context.bigArrays().newIntArray(1, true);
} }

View File

@ -30,7 +30,6 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.AggregationExecutionException; import org.elasticsearch.search.aggregations.AggregationExecutionException;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -52,10 +51,9 @@ public abstract class InternalMappedRareTerms<A extends InternalRareTerms<A, B>,
protected final Logger logger = LogManager.getLogger(getClass()); protected final Logger logger = LogManager.getLogger(getClass());
InternalMappedRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators, InternalMappedRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
Map<String, Object> metadata, DocValueFormat format,
List<B> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) { List<B> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) {
super(name, order, maxDocCount, pipelineAggregators, metadata); super(name, order, maxDocCount, metadata);
this.format = format; this.format = format;
this.buckets = buckets; this.buckets = buckets;
this.filter = filter; this.filter = filter;

View File

@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation; import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.KeyComparable; import org.elasticsearch.search.aggregations.KeyComparable;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
@ -122,9 +121,8 @@ public abstract class InternalRareTerms<A extends InternalRareTerms<A, B>, B ext
protected final BucketOrder order; protected final BucketOrder order;
protected final long maxDocCount; protected final long maxDocCount;
protected InternalRareTerms(String name, BucketOrder order, long maxDocCount, protected InternalRareTerms(String name, BucketOrder order, long maxDocCount, Map<String, Object> metadata) {
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { super(name, metadata);
super(name, pipelineAggregators, metadata);
this.order = order; this.order = order;
this.maxDocCount = maxDocCount; this.maxDocCount = maxDocCount;
} }

View File

@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -100,10 +99,9 @@ public class LongRareTerms extends InternalMappedRareTerms<LongRareTerms, LongRa
} }
} }
LongRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators, LongRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
Map<String, Object> metadata, DocValueFormat format,
List<LongRareTerms.Bucket> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) { List<LongRareTerms.Bucket> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) {
super(name, order, pipelineAggregators, metadata, format, buckets, maxDocCount, filter); super(name, order, metadata, format, buckets, maxDocCount, filter);
} }
/** /**
@ -120,7 +118,7 @@ public class LongRareTerms extends InternalMappedRareTerms<LongRareTerms, LongRa
@Override @Override
public LongRareTerms create(List<LongRareTerms.Bucket> buckets) { public LongRareTerms create(List<LongRareTerms.Bucket> buckets) {
return new LongRareTerms(name, order, pipelineAggregators(), metadata, format, buckets, maxDocCount, filter); return new LongRareTerms(name, order, metadata, format, buckets, maxDocCount, filter);
} }
@Override @Override
@ -130,8 +128,7 @@ public class LongRareTerms extends InternalMappedRareTerms<LongRareTerms, LongRa
@Override @Override
protected LongRareTerms createWithFilter(String name, List<LongRareTerms.Bucket> buckets, SetBackedScalingCuckooFilter filter) { protected LongRareTerms createWithFilter(String name, List<LongRareTerms.Bucket> buckets, SetBackedScalingCuckooFilter filter) {
return new LongRareTerms(name, order, pipelineAggregators(), getMetadata(), format, return new LongRareTerms(name, order, getMetadata(), format, buckets, maxDocCount, filter);
buckets, maxDocCount, filter);
} }
@Override @Override

View File

@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -49,10 +48,8 @@ public class LongRareTermsAggregator extends AbstractRareTermsAggregator<ValuesS
LongRareTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format, LongRareTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format,
SearchContext aggregationContext, Aggregator parent, IncludeExclude.LongFilter longFilter, SearchContext aggregationContext, Aggregator parent, IncludeExclude.LongFilter longFilter,
int maxDocCount, double precision, List<PipelineAggregator> pipelineAggregators, int maxDocCount, double precision, Map<String, Object> metadata) throws IOException {
Map<String, Object> metadata) throws IOException { super(name, factories, aggregationContext, parent, metadata, maxDocCount, precision, format, valuesSource, longFilter);
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata, maxDocCount, precision,
format, valuesSource, longFilter);
this.bucketOrds = new LongHash(1, aggregationContext.bigArrays()); this.bucketOrds = new LongHash(1, aggregationContext.bigArrays());
} }
@ -151,12 +148,12 @@ public class LongRareTermsAggregator extends AbstractRareTermsAggregator<ValuesS
} }
CollectionUtil.introSort(buckets, ORDER.comparator()); CollectionUtil.introSort(buckets, ORDER.comparator());
return new LongRareTerms(name, ORDER, pipelineAggregators(), metadata(), format, buckets, maxDocCount, filter); return new LongRareTerms(name, ORDER, metadata(), format, buckets, maxDocCount, filter);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new LongRareTerms(name, ORDER, pipelineAggregators(), metadata(), format, emptyList(), 0, filter); return new LongRareTerms(name, ORDER, metadata(), format, emptyList(), 0, filter);
} }
@Override @Override

View File

@ -32,13 +32,11 @@ import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter; import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
import static java.util.Collections.emptyList; import static java.util.Collections.emptyList;
@ -53,9 +51,8 @@ public class LongTermsAggregator extends TermsAggregator {
public LongTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format, public LongTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format,
BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent, BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent,
SubAggCollectionMode subAggCollectMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter, SubAggCollectionMode subAggCollectMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators, super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, metadata);
metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.showTermDocCountError = showTermDocCountError; this.showTermDocCountError = showTermDocCountError;
this.longFilter = longFilter; this.longFilter = longFilter;

View File

@ -29,14 +29,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> { public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
@ -58,10 +56,9 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new UnmappedRareTerms(name, pipelineAggregators, metadata); final InternalAggregation aggregation = new UnmappedRareTerms(name, metadata);
return new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) { return new NonCollectingAggregator(name, searchContext, parent, factories, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;
@ -74,7 +71,6 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
@ -90,7 +86,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
} }
return execution.create(name, factories, valuesSource, format, return execution.create(name, factories, valuesSource, format,
includeExclude, searchContext, parent, pipelineAggregators, metadata, maxDocCount, precision); includeExclude, searchContext, parent, metadata, maxDocCount, precision);
} }
if ((includeExclude != null) && (includeExclude.isRegexBased())) { if ((includeExclude != null) && (includeExclude.isRegexBased())) {
@ -108,7 +104,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
longFilter = includeExclude.convertToLongFilter(config.format()); longFilter = includeExclude.convertToLongFilter(config.format());
} }
return new LongRareTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), return new LongRareTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(),
searchContext, parent, longFilter, maxDocCount, precision, pipelineAggregators, metadata); searchContext, parent, longFilter, maxDocCount, precision, metadata);
} }
throw new AggregationExecutionException("RareTerms aggregation cannot be applied to field [" + config.fieldContext().field() throw new AggregationExecutionException("RareTerms aggregation cannot be applied to field [" + config.fieldContext().field()
@ -123,12 +119,11 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource, Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource,
DocValueFormat format, IncludeExclude includeExclude, DocValueFormat format, IncludeExclude includeExclude,
SearchContext context, Aggregator parent, SearchContext context, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata, long maxDocCount, double precision) Map<String, Object> metadata, long maxDocCount, double precision)
throws IOException { throws IOException {
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format); final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
return new StringRareTermsAggregator(name, factories, (ValuesSource.Bytes) valuesSource, format, filter, return new StringRareTermsAggregator(name, factories, (ValuesSource.Bytes) valuesSource, format, filter,
context, parent, pipelineAggregators, metadata, maxDocCount, precision); context, parent, metadata, maxDocCount, precision);
} }
@Override @Override
@ -155,8 +150,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
abstract Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource, abstract Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource,
DocValueFormat format, IncludeExclude includeExclude, DocValueFormat format, IncludeExclude includeExclude,
SearchContext context, Aggregator parent, SearchContext context, Aggregator parent, Map<String, Object> metadata,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata,
long maxDocCount, double precision) long maxDocCount, double precision)
throws IOException; throws IOException;

View File

@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.BucketOrder; import org.elasticsearch.search.aggregations.BucketOrder;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -102,10 +101,9 @@ public class StringRareTerms extends InternalMappedRareTerms<StringRareTerms, St
} }
} }
StringRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators, StringRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
Map<String, Object> metadata, DocValueFormat format,
List<StringRareTerms.Bucket> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) { List<StringRareTerms.Bucket> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) {
super(name, order, pipelineAggregators, metadata, format, buckets, maxDocCount, filter); super(name, order, metadata, format, buckets, maxDocCount, filter);
} }
/** /**
@ -122,7 +120,7 @@ public class StringRareTerms extends InternalMappedRareTerms<StringRareTerms, St
@Override @Override
public StringRareTerms create(List<StringRareTerms.Bucket> buckets) { public StringRareTerms create(List<StringRareTerms.Bucket> buckets) {
return new StringRareTerms(name, order, pipelineAggregators(), metadata, format, buckets, maxDocCount, filter); return new StringRareTerms(name, order, metadata, format, buckets, maxDocCount, filter);
} }
@Override @Override
@ -133,8 +131,7 @@ public class StringRareTerms extends InternalMappedRareTerms<StringRareTerms, St
@Override @Override
protected StringRareTerms createWithFilter(String name, List<StringRareTerms.Bucket> buckets, protected StringRareTerms createWithFilter(String name, List<StringRareTerms.Bucket> buckets,
SetBackedScalingCuckooFilter filterFilter) { SetBackedScalingCuckooFilter filterFilter) {
return new StringRareTerms(name, order, pipelineAggregators(), metadata, format, return new StringRareTerms(name, order, metadata, format, buckets, maxDocCount, filterFilter);
buckets, maxDocCount, filterFilter);
} }
@Override @Override

View File

@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
@ -50,9 +49,9 @@ public class StringRareTermsAggregator extends AbstractRareTermsAggregator<Value
StringRareTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Bytes valuesSource, StringRareTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Bytes valuesSource,
DocValueFormat format, IncludeExclude.StringFilter stringFilter, DocValueFormat format, IncludeExclude.StringFilter stringFilter,
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators, SearchContext context, Aggregator parent,
Map<String, Object> metadata, long maxDocCount, double precision) throws IOException { Map<String, Object> metadata, long maxDocCount, double precision) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata, maxDocCount, precision, format, valuesSource, stringFilter); super(name, factories, context, parent, metadata, maxDocCount, precision, format, valuesSource, stringFilter);
this.bucketOrds = new BytesRefHash(1, context.bigArrays()); this.bucketOrds = new BytesRefHash(1, context.bigArrays());
} }
@ -156,12 +155,12 @@ public class StringRareTermsAggregator extends AbstractRareTermsAggregator<Value
} }
CollectionUtil.introSort(buckets, ORDER.comparator()); CollectionUtil.introSort(buckets, ORDER.comparator());
return new StringRareTerms(name, ORDER, pipelineAggregators(), metadata(), format, buckets, maxDocCount, filter); return new StringRareTerms(name, ORDER, metadata(), format, buckets, maxDocCount, filter);
} }
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return new StringRareTerms(name, LongRareTermsAggregator.ORDER, pipelineAggregators(), metadata(), format, emptyList(), 0, filter); return new StringRareTerms(name, LongRareTermsAggregator.ORDER, metadata(), format, emptyList(), 0, filter);
} }
@Override @Override

View File

@ -33,13 +33,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalOrder; import org.elasticsearch.search.aggregations.InternalOrder;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -55,10 +53,9 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator {
BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds, BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds,
IncludeExclude.StringFilter includeExclude, SearchContext context, IncludeExclude.StringFilter includeExclude, SearchContext context,
Aggregator parent, SubAggCollectionMode collectionMode, boolean showTermDocCountError, Aggregator parent, SubAggCollectionMode collectionMode, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata);
pipelineAggregators, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.includeExclude = includeExclude; this.includeExclude = includeExclude;
bucketOrds = new BytesRefHash(1, context.bigArrays()); bucketOrds = new BytesRefHash(1, context.bigArrays());

View File

@ -34,14 +34,12 @@ import org.elasticsearch.search.aggregations.InternalOrder.Aggregation;
import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder; import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder;
import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator; import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator; import org.elasticsearch.search.aggregations.bucket.nested.NestedAggregator;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.AggregationPath; import org.elasticsearch.search.aggregations.support.AggregationPath;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Set; import java.util.Set;
@ -180,8 +178,8 @@ public abstract class TermsAggregator extends DeferableBucketAggregator {
public TermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent, public TermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
BucketCountThresholds bucketCountThresholds, BucketOrder order, DocValueFormat format, SubAggCollectionMode collectMode, BucketCountThresholds bucketCountThresholds, BucketOrder order, DocValueFormat format, SubAggCollectionMode collectMode,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, factories, context, parent, pipelineAggregators, metadata); super(name, factories, context, parent, metadata);
this.bucketCountThresholds = bucketCountThresholds; this.bucketCountThresholds = bucketCountThresholds;
this.order = order; this.order = order;
partiallyBuiltBucketComparator = order == null ? null : order.partiallyBuiltBucketComparator(b -> b.bucketOrd, this); partiallyBuiltBucketComparator = order == null ? null : order.partiallyBuiltBucketComparator(b -> b.bucketOrd, this);

View File

@ -37,14 +37,12 @@ import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder;
import org.elasticsearch.search.aggregations.NonCollectingAggregator; import org.elasticsearch.search.aggregations.NonCollectingAggregator;
import org.elasticsearch.search.aggregations.bucket.BucketUtils; import org.elasticsearch.search.aggregations.bucket.BucketUtils;
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds; import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig; import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> { public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
@ -59,6 +57,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
private final TermsAggregator.BucketCountThresholds bucketCountThresholds; private final TermsAggregator.BucketCountThresholds bucketCountThresholds;
private final boolean showTermDocCountError; private final boolean showTermDocCountError;
TermsAggregatorFactory(String name, TermsAggregatorFactory(String name,
ValuesSourceConfig<ValuesSource> config, ValuesSourceConfig<ValuesSource> config,
BucketOrder order, BucketOrder order,
@ -83,11 +82,10 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(), final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(),
bucketCountThresholds.getMinDocCount(), metadata); bucketCountThresholds.getMinDocCount(), metadata);
Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) { Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, metadata) {
@Override @Override
public InternalAggregation buildEmptyAggregation() { public InternalAggregation buildEmptyAggregation() {
return aggregation; return aggregation;
@ -114,7 +112,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
if (collectsFromSingleBucket == false) { if (collectsFromSingleBucket == false) {
return asMultiBucketAggregator(this, searchContext, parent); return asMultiBucketAggregator(this, searchContext, parent);
@ -157,7 +154,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
} }
return execution.create(name, factories, valuesSource, order, format, return execution.create(name, factories, valuesSource, order, format,
bucketCountThresholds, includeExclude, searchContext, parent, cm, showTermDocCountError, pipelineAggregators, metadata); bucketCountThresholds, includeExclude, searchContext, parent, cm, showTermDocCountError, metadata);
} }
if ((includeExclude != null) && (includeExclude.isRegexBased())) { if ((includeExclude != null) && (includeExclude.isRegexBased())) {
@ -181,15 +178,13 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
longFilter = includeExclude.convertToDoubleFilter(); longFilter = includeExclude.convertToDoubleFilter();
} }
return new DoubleTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order, return new DoubleTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order,
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, metadata);
pipelineAggregators, metadata);
} }
if (includeExclude != null) { if (includeExclude != null) {
longFilter = includeExclude.convertToLongFilter(config.format()); longFilter = includeExclude.convertToLongFilter(config.format());
} }
return new LongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order, return new LongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order,
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, pipelineAggregators, bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, metadata);
metadata);
} }
throw new AggregationExecutionException("terms aggregation cannot be applied to field [" + config.fieldContext().field() throw new AggregationExecutionException("terms aggregation cannot be applied to field [" + config.fieldContext().field()
@ -239,11 +234,10 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
Aggregator parent, Aggregator parent,
SubAggCollectionMode subAggCollectMode, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format); final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
return new StringTermsAggregator(name, factories, valuesSource, order, format, bucketCountThresholds, filter, return new StringTermsAggregator(name, factories, valuesSource, order, format, bucketCountThresholds, filter,
context, parent, subAggCollectMode, showTermDocCountError, pipelineAggregators, metadata); context, parent, subAggCollectMode, showTermDocCountError, metadata);
} }
}, },
GLOBAL_ORDINALS(new ParseField("global_ordinals")) { GLOBAL_ORDINALS(new ParseField("global_ordinals")) {
@ -259,7 +253,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
SearchContext context, Aggregator parent, SearchContext context, Aggregator parent,
SubAggCollectionMode subAggCollectMode, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
final long maxOrd = getMaxOrd(valuesSource, context.searcher()); final long maxOrd = getMaxOrd(valuesSource, context.searcher());
@ -286,7 +279,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
*/ */
return new GlobalOrdinalsStringTermsAggregator.LowCardinality(name, factories, return new GlobalOrdinalsStringTermsAggregator.LowCardinality(name, factories,
ordinalsValuesSource, order, format, bucketCountThresholds, context, parent, false, ordinalsValuesSource, order, format, bucketCountThresholds, context, parent, false,
subAggCollectMode, showTermDocCountError, pipelineAggregators, metadata); subAggCollectMode, showTermDocCountError, metadata);
} }
final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format); final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format);
@ -312,7 +305,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
} }
return new GlobalOrdinalsStringTermsAggregator(name, factories, ordinalsValuesSource, order, return new GlobalOrdinalsStringTermsAggregator(name, factories, ordinalsValuesSource, order,
format, bucketCountThresholds, filter, context, parent, remapGlobalOrds, subAggCollectMode, showTermDocCountError, format, bucketCountThresholds, filter, context, parent, remapGlobalOrds, subAggCollectMode, showTermDocCountError,
pipelineAggregators, metadata); metadata);
} }
}; };
@ -344,7 +337,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
Aggregator parent, Aggregator parent,
SubAggCollectionMode subAggCollectMode, SubAggCollectionMode subAggCollectMode,
boolean showTermDocCountError, boolean showTermDocCountError,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException; Map<String, Object> metadata) throws IOException;
@Override @Override

View File

@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.InternalAggregations; import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Collections; import java.util.Collections;
@ -46,8 +45,8 @@ public class UnmappedRareTerms extends InternalRareTerms<UnmappedRareTerms, Unma
} }
} }
UnmappedRareTerms(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) { UnmappedRareTerms(String name, Map<String, Object> metadata) {
super(name, LongRareTermsAggregator.ORDER, 0, pipelineAggregators, metadata); super(name, LongRareTermsAggregator.ORDER, 0, metadata);
} }
/** /**
@ -74,7 +73,7 @@ public class UnmappedRareTerms extends InternalRareTerms<UnmappedRareTerms, Unma
@Override @Override
public UnmappedRareTerms create(List<UnmappedRareTerms.Bucket> buckets) { public UnmappedRareTerms create(List<UnmappedRareTerms.Bucket> buckets) {
return new UnmappedRareTerms(name, pipelineAggregators(), metadata); return new UnmappedRareTerms(name, metadata);
} }
@Override @Override
@ -94,7 +93,7 @@ public class UnmappedRareTerms extends InternalRareTerms<UnmappedRareTerms, Unma
@Override @Override
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) { public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
return new UnmappedRareTerms(name, pipelineAggregators(), metadata); return new UnmappedRareTerms(name, metadata);
} }
@Override @Override

View File

@ -33,12 +33,10 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
abstract class AbstractHDRPercentilesAggregator extends NumericMetricsAggregator.MultiValue { abstract class AbstractHDRPercentilesAggregator extends NumericMetricsAggregator.MultiValue {
@ -56,8 +54,8 @@ abstract class AbstractHDRPercentilesAggregator extends NumericMetricsAggregator
AbstractHDRPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent, AbstractHDRPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent,
double[] keys, int numberOfSignificantValueDigits, boolean keyed, DocValueFormat formatter, double[] keys, int numberOfSignificantValueDigits, boolean keyed, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.keyed = keyed; this.keyed = keyed;
this.format = formatter; this.format = formatter;

View File

@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.search.DocValueFormat; import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
@ -39,9 +38,8 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
final boolean keyed; final boolean keyed;
AbstractInternalTDigestPercentiles(String name, double[] keys, TDigestState state, boolean keyed, DocValueFormat formatter, AbstractInternalTDigestPercentiles(String name, double[] keys, TDigestState state, boolean keyed, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) { Map<String, Object> metadata) {
super(name, pipelineAggregators, metadata); super(name, metadata);
this.keys = keys; this.keys = keys;
this.state = state; this.state = state;
this.keyed = keyed; this.keyed = keyed;
@ -96,11 +94,11 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
} }
merged.add(percentiles.state); merged.add(percentiles.state);
} }
return createReduced(getName(), keys, merged, keyed, pipelineAggregators(), getMetadata()); return createReduced(getName(), keys, merged, keyed, getMetadata());
} }
protected abstract AbstractInternalTDigestPercentiles createReduced(String name, double[] keys, TDigestState merged, boolean keyed, protected abstract AbstractInternalTDigestPercentiles createReduced(String name, double[] keys, TDigestState merged, boolean keyed,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata); Map<String, Object> metadata);
@Override @Override
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException { public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {

View File

@ -32,12 +32,10 @@ import org.elasticsearch.search.DocValueFormat;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
abstract class AbstractTDigestPercentilesAggregator extends NumericMetricsAggregator.MultiValue { abstract class AbstractTDigestPercentilesAggregator extends NumericMetricsAggregator.MultiValue {
@ -55,8 +53,8 @@ abstract class AbstractTDigestPercentilesAggregator extends NumericMetricsAggreg
AbstractTDigestPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent, AbstractTDigestPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent,
double[] keys, double compression, boolean keyed, DocValueFormat formatter, double[] keys, double compression, boolean keyed, DocValueFormat formatter,
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.keyed = keyed; this.keyed = keyed;
this.formatter = formatter; this.formatter = formatter;

View File

@ -30,12 +30,10 @@ import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.InternalAggregation; import org.elasticsearch.search.aggregations.InternalAggregation;
import org.elasticsearch.search.aggregations.LeafBucketCollector; import org.elasticsearch.search.aggregations.LeafBucketCollector;
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase; import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
class AvgAggregator extends NumericMetricsAggregator.SingleValue { class AvgAggregator extends NumericMetricsAggregator.SingleValue {
@ -48,8 +46,8 @@ class AvgAggregator extends NumericMetricsAggregator.SingleValue {
DocValueFormat format; DocValueFormat format;
AvgAggregator(String name, ValuesSource.Numeric valuesSource, DocValueFormat formatter, SearchContext context, AvgAggregator(String name, ValuesSource.Numeric valuesSource, DocValueFormat formatter, SearchContext context,
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException { Aggregator parent, Map<String, Object> metadata) throws IOException {
super(name, context, parent, pipelineAggregators, metadata); super(name, context, parent, metadata);
this.valuesSource = valuesSource; this.valuesSource = valuesSource;
this.format = formatter; this.format = formatter;
if (valuesSource != null) { if (valuesSource != null) {

View File

@ -23,7 +23,6 @@ import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.search.aggregations.Aggregator; import org.elasticsearch.search.aggregations.Aggregator;
import org.elasticsearch.search.aggregations.AggregatorFactories; import org.elasticsearch.search.aggregations.AggregatorFactories;
import org.elasticsearch.search.aggregations.AggregatorFactory; import org.elasticsearch.search.aggregations.AggregatorFactory;
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
import org.elasticsearch.search.aggregations.support.ValuesSource; import org.elasticsearch.search.aggregations.support.ValuesSource;
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric; import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory; import org.elasticsearch.search.aggregations.support.ValuesSourceAggregatorFactory;
@ -31,7 +30,6 @@ import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
import org.elasticsearch.search.internal.SearchContext; import org.elasticsearch.search.internal.SearchContext;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import java.util.Map; import java.util.Map;
class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> { class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> {
@ -44,9 +42,8 @@ class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Nu
@Override @Override
protected Aggregator createUnmapped(SearchContext searchContext, protected Aggregator createUnmapped(SearchContext searchContext,
Aggregator parent, Aggregator parent,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new AvgAggregator(name, null, config.format(), searchContext, parent, pipelineAggregators, metadata); return new AvgAggregator(name, null, config.format(), searchContext, parent, metadata);
} }
@Override @Override
@ -54,8 +51,7 @@ class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Nu
SearchContext searchContext, SearchContext searchContext,
Aggregator parent, Aggregator parent,
boolean collectsFromSingleBucket, boolean collectsFromSingleBucket,
List<PipelineAggregator> pipelineAggregators,
Map<String, Object> metadata) throws IOException { Map<String, Object> metadata) throws IOException {
return new AvgAggregator(name, valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata); return new AvgAggregator(name, valuesSource, config.format(), searchContext, parent, metadata);
} }
} }

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