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:
parent
100f7258c7
commit
ce7ae4a7d1
|
@ -30,13 +30,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
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.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -50,9 +48,8 @@ final class MatrixStatsAggregator extends MetricsAggregator {
|
|||
ObjectArray<RunningStats> stats;
|
||||
|
||||
MatrixStatsAggregator(String name, Map<String, ValuesSource.Numeric> valuesSources, SearchContext context,
|
||||
Aggregator parent, MultiValueMode multiValueMode, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String,Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
Aggregator parent, MultiValueMode multiValueMode, Map<String,Object> metadata) throws IOException {
|
||||
super(name, context, parent, metadata);
|
||||
if (valuesSources != null && !valuesSources.isEmpty()) {
|
||||
this.valuesSources = new NumericArrayValuesSource(valuesSources, multiValueMode);
|
||||
stats = context.bigArrays().newObjectArray(1);
|
||||
|
|
|
@ -23,14 +23,12 @@ import org.elasticsearch.search.MultiValueMode;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFactory<ValuesSource.Numeric> {
|
||||
|
@ -51,10 +49,9 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata)
|
||||
throws IOException {
|
||||
return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, pipelineAggregators, metadata);
|
||||
return new MatrixStatsAggregator(name, null, searchContext, parent, multiValueMode, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,8 +59,7 @@ final class MatrixStatsAggregatorFactory extends ArrayValuesSourceAggregatorFact
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,12 +23,10 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource>
|
||||
|
@ -48,7 +46,6 @@ public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
HashMap<String, VS> valuesSources = new HashMap<>();
|
||||
|
||||
|
@ -59,22 +56,19 @@ public abstract class ArrayValuesSourceAggregatorFactory<VS extends ValuesSource
|
|||
}
|
||||
}
|
||||
if (valuesSources.isEmpty()) {
|
||||
return createUnmapped(searchContext, parent, pipelineAggregators, metadata);
|
||||
return createUnmapped(searchContext, parent, metadata);
|
||||
}
|
||||
return doCreateInternal(valuesSources, searchContext, parent,
|
||||
collectsFromSingleBucket, pipelineAggregators, metadata);
|
||||
return doCreateInternal(valuesSources, searchContext, parent, collectsFromSingleBucket, metadata);
|
||||
}
|
||||
|
||||
protected abstract Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
|
||||
protected abstract Aggregator doCreateInternal(Map<String, VS> valuesSources,
|
||||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
|
||||
}
|
||||
|
|
|
@ -26,14 +26,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> {
|
||||
|
@ -56,12 +54,11 @@ public class ChildrenAggregatorFactory extends ValuesSourceAggregatorFactory<Wit
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
return new NonCollectingAggregator(name, searchContext, parent, metadata) {
|
||||
@Override
|
||||
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,
|
||||
SearchContext searchContext, Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher());
|
||||
if (collectsFromSingleBucket) {
|
||||
return new ParentToChildrenAggregator(name, factories, searchContext, parent, childFilter,
|
||||
parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata);
|
||||
parentFilter, valuesSource, maxOrd, metadata);
|
||||
} else {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,10 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -42,19 +40,18 @@ public class ChildrenToParentAggregator extends ParentJoinAggregator {
|
|||
public ChildrenToParentAggregator(String name, AggregatorFactories factories,
|
||||
SearchContext context, Aggregator parent, Query childFilter,
|
||||
Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource,
|
||||
long maxOrd, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata);
|
||||
long maxOrd, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, childFilter, parentFilter, valuesSource, maxOrd, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalParent(name, bucketDocCount(owningBucketOrdinal),
|
||||
bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata());
|
||||
bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalParent(name, 0, buildEmptySubAggregations(), pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalParent(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,19 +22,16 @@ package org.elasticsearch.join.aggregations;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Results of the {@link ParentToChildrenAggregator}.
|
||||
*/
|
||||
public class InternalChildren extends InternalSingleBucketAggregation implements Children {
|
||||
public InternalChildren(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
public InternalChildren(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +48,6 @@ public class InternalChildren extends InternalSingleBucketAggregation implements
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalChildren(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalChildren(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,19 +22,16 @@ package org.elasticsearch.join.aggregations;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Results of the {@link ChildrenToParentAggregator}.
|
||||
*/
|
||||
public class InternalParent extends InternalSingleBucketAggregation implements Parent {
|
||||
public InternalParent(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
public InternalParent(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +48,6 @@ public class InternalParent extends InternalSingleBucketAggregation implements P
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalParent(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalParent(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,14 +26,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithOrdinals> {
|
||||
|
@ -57,11 +55,11 @@ public class ParentAggregatorFactory extends ValuesSourceAggregatorFactory<WithO
|
|||
|
||||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new NonCollectingAggregator(name, searchContext, parent, metadata) {
|
||||
@Override
|
||||
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,
|
||||
SearchContext searchContext, Aggregator children,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
long maxOrd = valuesSource.globalMaxOrd(searchContext.searcher());
|
||||
if (collectsFromSingleBucket) {
|
||||
return new ChildrenToParentAggregator(name, factories, searchContext, children, childFilter,
|
||||
parentFilter, valuesSource, maxOrd, pipelineAggregators, metadata);
|
||||
parentFilter, valuesSource, maxOrd, metadata);
|
||||
} else {
|
||||
return asMultiBucketAggregator(this, searchContext, children);
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.apache.lucene.index.SortedSetDocValues;
|
|||
import org.apache.lucene.search.DocIdSetIterator;
|
||||
import org.apache.lucene.search.Query;
|
||||
import org.apache.lucene.search.Scorable;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.ScoreMode;
|
||||
import org.apache.lucene.search.Scorer;
|
||||
import org.apache.lucene.search.Weight;
|
||||
import org.apache.lucene.util.Bits;
|
||||
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.bucket.BucketsAggregator;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -73,9 +71,8 @@ public abstract class ParentJoinAggregator extends BucketsAggregator implements
|
|||
Query outFilter,
|
||||
ValuesSource.Bytes.WithOrdinals valuesSource,
|
||||
long maxOrd,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
|
||||
if (maxOrd > Integer.MAX_VALUE) {
|
||||
throw new IllegalStateException("the number of parent [" + maxOrd + "] + is greater than the allowed limit " +
|
||||
|
|
|
@ -23,12 +23,10 @@ import org.elasticsearch.common.ParseField;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ParentToChildrenAggregator extends ParentJoinAggregator {
|
||||
|
@ -38,19 +36,18 @@ public class ParentToChildrenAggregator extends ParentJoinAggregator {
|
|||
public ParentToChildrenAggregator(String name, AggregatorFactories factories,
|
||||
SearchContext context, Aggregator parent, Query childFilter,
|
||||
Query parentFilter, ValuesSource.Bytes.WithOrdinals valuesSource,
|
||||
long maxOrd, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, pipelineAggregators, metadata);
|
||||
long maxOrd, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, parentFilter, childFilter, valuesSource, maxOrd, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalChildren(name, bucketDocCount(owningBucketOrdinal),
|
||||
bucketAggregations(owningBucketOrdinal), pipelineAggregators(), metadata());
|
||||
bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalChildren(name, 0, buildEmptySubAggregations(), pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalChildren(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.Aggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalSingleBucketAggregationTestCase;
|
||||
import org.elasticsearch.search.aggregations.bucket.ParsedSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -45,8 +44,8 @@ public class InternalChildrenTests extends InternalSingleBucketAggregationTestCa
|
|||
|
||||
@Override
|
||||
protected InternalChildren createTestInstance(String name, long docCount, InternalAggregations aggregations,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalChildren(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalChildren(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,10 +19,6 @@
|
|||
|
||||
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.io.stream.Writeable.Reader;
|
||||
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.InternalSingleBucketAggregationTestCase;
|
||||
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> {
|
||||
|
||||
|
@ -44,8 +43,8 @@ public class InternalParentTests extends InternalSingleBucketAggregationTestCase
|
|||
|
||||
@Override
|
||||
protected InternalParent createTestInstance(String name, long docCount, InternalAggregations aggregations,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
return new InternalParent(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
return new InternalParent(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.breaker.CircuitBreaker;
|
|||
import org.elasticsearch.common.breaker.CircuitBreakingException;
|
||||
import org.elasticsearch.indices.breaker.CircuitBreakerService;
|
||||
import org.elasticsearch.search.SearchShardTarget;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.search.internal.SearchContext.Lifetime;
|
||||
import org.elasticsearch.search.query.QueryPhaseExecutionException;
|
||||
|
@ -53,7 +52,6 @@ public abstract class AggregatorBase extends Aggregator {
|
|||
protected BucketCollector collectableSubAggregators;
|
||||
|
||||
private Map<String, Aggregator> subAggregatorbyName;
|
||||
private final List<PipelineAggregator> pipelineAggregators;
|
||||
private final CircuitBreakerService breakerService;
|
||||
private long requestBytesUsed;
|
||||
|
||||
|
@ -67,9 +65,8 @@ public abstract class AggregatorBase extends Aggregator {
|
|||
* @param metadata The metadata associated with this aggregator
|
||||
*/
|
||||
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.pipelineAggregators = pipelineAggregators;
|
||||
this.metadata = metadata;
|
||||
this.parent = parent;
|
||||
this.context = context;
|
||||
|
@ -152,10 +149,6 @@ public abstract class AggregatorBase extends Aggregator {
|
|||
return this.metadata;
|
||||
}
|
||||
|
||||
public List<PipelineAggregator> pipelineAggregators() {
|
||||
return this.pipelineAggregators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a {@link LeafBucketCollector} for the given ctx, which should
|
||||
* delegate to the given collector.
|
||||
|
|
|
@ -223,13 +223,6 @@ public class AggregatorFactories {
|
|||
return factories.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the number of pipeline aggregator factories
|
||||
*/
|
||||
public int countPipelineAggregators() {
|
||||
return pipelineAggregatorFactories.size();
|
||||
}
|
||||
|
||||
public static class Builder implements Writeable, ToXContentObject {
|
||||
private final Set<String> names = new HashSet<>();
|
||||
|
||||
|
|
|
@ -26,12 +26,10 @@ import org.elasticsearch.common.lease.Releasables;
|
|||
import org.elasticsearch.common.util.BigArrays;
|
||||
import org.elasticsearch.common.util.ObjectArray;
|
||||
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.Lifetime;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class AggregatorFactory {
|
||||
|
@ -201,7 +199,6 @@ public abstract class AggregatorFactory {
|
|||
protected abstract Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
|
||||
/**
|
||||
|
@ -222,7 +219,7 @@ public abstract class AggregatorFactory {
|
|||
* @return The created aggregator
|
||||
*/
|
||||
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() {
|
||||
|
|
|
@ -41,7 +41,6 @@ import java.util.function.Function;
|
|||
import java.util.function.IntConsumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
/**
|
||||
|
@ -147,7 +146,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
|
||||
protected final Map<String, Object> metadata;
|
||||
|
||||
private final List<PipelineAggregator> pipelineAggregators;
|
||||
private List<PipelineAggregator> pipelineAggregatorsForBwcSerialization;
|
||||
|
||||
/**
|
||||
|
@ -157,20 +155,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
*/
|
||||
protected InternalAggregation(String name, Map<String, Object> metadata) {
|
||||
this.name = name;
|
||||
this.pipelineAggregators = emptyList();
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an aggregation result with a given name.
|
||||
*
|
||||
* @param name The name of the aggregation.
|
||||
* @deprecated pipelines are being removed from the aggregation tree. Use the other ctor.
|
||||
*/
|
||||
@Deprecated
|
||||
protected InternalAggregation(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
this.name = name;
|
||||
this.pipelineAggregators = pipelineAggregators;
|
||||
this.metadata = metadata;
|
||||
}
|
||||
|
||||
|
@ -191,7 +175,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
protected InternalAggregation(StreamInput in) throws IOException {
|
||||
name = in.readString();
|
||||
metadata = in.readMap();
|
||||
pipelineAggregators = emptyList();
|
||||
if (in.getVersion().before(Version.V_7_8_0)) {
|
||||
in.readNamedWriteableList(PipelineAggregator.class);
|
||||
}
|
||||
|
@ -310,14 +293,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
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.
|
||||
* @deprecated only use these for serializing to older Elasticsearch versions
|
||||
|
@ -353,7 +328,7 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, metadata, pipelineAggregators);
|
||||
return Objects.hash(name, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -365,7 +340,6 @@ public abstract class InternalAggregation implements Aggregation, NamedWriteable
|
|||
|
||||
InternalAggregation other = (InternalAggregation) obj;
|
||||
return Objects.equals(name, other.name) &&
|
||||
Objects.equals(pipelineAggregators, other.pipelineAggregators) &&
|
||||
Objects.equals(metadata, other.metadata);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.io.stream.StreamInput;
|
|||
import org.elasticsearch.common.io.stream.Writeable;
|
||||
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator.PipelineTree;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -41,14 +40,6 @@ public abstract class InternalMultiBucketAggregation<A extends InternalMultiBuck
|
|||
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.
|
||||
*/
|
||||
|
|
|
@ -20,11 +20,9 @@
|
|||
package org.elasticsearch.search.aggregations;
|
||||
|
||||
import org.apache.lucene.index.LeafReaderContext;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -34,13 +32,13 @@ import java.util.Map;
|
|||
public abstract class NonCollectingAggregator extends AggregatorBase {
|
||||
|
||||
protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent, AggregatorFactories subFactories,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, subFactories, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, subFactories, context, parent, metadata);
|
||||
}
|
||||
|
||||
protected NonCollectingAggregator(String name, SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
this(name, context, parent, AggregatorFactories.EMPTY, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
this(name, context, parent, AggregatorFactories.EMPTY, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.AggregationPath;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
import org.elasticsearch.search.sort.SortOrder;
|
||||
|
@ -35,7 +34,6 @@ import org.elasticsearch.search.sort.SortOrder;
|
|||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.IntConsumer;
|
||||
|
||||
|
@ -46,8 +44,8 @@ public abstract class BucketsAggregator extends AggregatorBase {
|
|||
private IntArray docCounts;
|
||||
|
||||
public BucketsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
bigArrays = context.bigArrays();
|
||||
docCounts = bigArrays.newIntArray(1, true);
|
||||
if (context.aggregations() != null) {
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.BucketCollector;
|
||||
import org.elasticsearch.search.aggregations.MultiBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.bucket.global.GlobalAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -37,8 +36,8 @@ public abstract class DeferableBucketAggregator extends BucketsAggregator {
|
|||
private DeferringBucketCollector recordingWrapper;
|
||||
|
||||
protected DeferableBucketAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.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.
|
||||
*/
|
||||
protected InternalSingleBucketAggregation(String name, long docCount, InternalAggregations aggregations,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.docCount = docCount;
|
||||
this.aggregations = aggregations;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -129,9 +128,8 @@ public class AdjacencyMatrixAggregator extends BucketsAggregator {
|
|||
private final String separator;
|
||||
|
||||
public AdjacencyMatrixAggregator(String name, AggregatorFactories factories, String separator, String[] keys,
|
||||
Weight[] filters, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Weight[] filters, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.separator = separator;
|
||||
this.keys = keys;
|
||||
this.filters = filters;
|
||||
|
@ -210,13 +208,13 @@ public class AdjacencyMatrixAggregator extends BucketsAggregator {
|
|||
pos++;
|
||||
}
|
||||
}
|
||||
return new InternalAdjacencyMatrix(name, buckets, pipelineAggregators(), metadata());
|
||||
return new InternalAdjacencyMatrix(name, buckets, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
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) {
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.bucket.adjacency.AdjacencyMatrixAggregator.KeyedFilter;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -61,10 +60,8 @@ public class AdjacencyMatrixAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new AdjacencyMatrixAggregator(name, factories, separator, keys, weights, searchContext, parent,
|
||||
pipelineAggregators, metadata);
|
||||
return new AdjacencyMatrixAggregator(name, factories, separator, keys, weights, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -120,9 +119,8 @@ public class InternalAdjacencyMatrix
|
|||
private final List<InternalBucket> buckets;
|
||||
private Map<String, InternalBucket> bucketMap;
|
||||
|
||||
public InternalAdjacencyMatrix(String name, List<InternalBucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalAdjacencyMatrix(String name, List<InternalBucket> buckets, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.buckets = buckets;
|
||||
}
|
||||
|
||||
|
@ -155,7 +153,7 @@ public class InternalAdjacencyMatrix
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -206,8 +204,7 @@ public class InternalAdjacencyMatrix
|
|||
}
|
||||
Collections.sort(reducedBuckets, Comparator.comparing(InternalBucket::getKey));
|
||||
|
||||
InternalAdjacencyMatrix reduced = new InternalAdjacencyMatrix(name, reducedBuckets, pipelineAggregators(),
|
||||
getMetadata());
|
||||
InternalAdjacencyMatrix reduced = new InternalAdjacencyMatrix(name, reducedBuckets, getMetadata());
|
||||
|
||||
return reduced;
|
||||
}
|
||||
|
|
|
@ -23,11 +23,9 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class CompositeAggregationFactory extends AggregatorFactory {
|
||||
|
@ -46,8 +44,7 @@ class CompositeAggregationFactory extends AggregatorFactory {
|
|||
|
||||
@Override
|
||||
protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
return new CompositeAggregator(name, factories, searchContext, parent, pipelineAggregators, metadata,
|
||||
size, sources, afterKey);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new CompositeAggregator(name, factories, searchContext, parent, metadata, size, sources, afterKey);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ import org.elasticsearch.search.aggregations.MultiBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.MultiBucketConsumerService;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
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.internal.SearchContext;
|
||||
import org.elasticsearch.search.searchafter.SearchAfterBuilder;
|
||||
|
@ -89,9 +88,9 @@ final class CompositeAggregator extends BucketsAggregator {
|
|||
private boolean earlyTerminated;
|
||||
|
||||
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 {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.size = size;
|
||||
this.sourceNames = Arrays.stream(sourceConfigs).map(CompositeValuesSourceConfig::name).collect(Collectors.toList());
|
||||
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;
|
||||
return new InternalComposite(name, size, sourceNames, formats, Arrays.asList(buckets), lastBucket, reverseMuls,
|
||||
earlyTerminated, pipelineAggregators(), metadata());
|
||||
earlyTerminated, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalComposite(name, size, sourceNames, formats, Collections.emptyList(), null, reverseMuls,
|
||||
false, pipelineAggregators(), metadata());
|
||||
false, metadata());
|
||||
}
|
||||
|
||||
private void finishLeaf() {
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.AbstractMap;
|
||||
|
@ -58,8 +57,8 @@ public class InternalComposite
|
|||
|
||||
InternalComposite(String name, int size, List<String> sourceNames, List<DocValueFormat> formats,
|
||||
List<InternalBucket> buckets, CompositeKey afterKey, int[] reverseMuls, boolean earlyTerminated,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.sourceNames = sourceNames;
|
||||
this.formats = formats;
|
||||
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.
|
||||
*/
|
||||
return new InternalComposite(name, size, sourceNames, formats, newBuckets, afterKey,
|
||||
reverseMuls, earlyTerminated, pipelineAggregators(), getMetadata());
|
||||
reverseMuls, earlyTerminated, getMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -222,7 +221,7 @@ public class InternalComposite
|
|||
lastKey = lastBucket.getRawKey();
|
||||
}
|
||||
return new InternalComposite(name, size, sourceNames, reducedFormats, result, lastKey, reverseMuls,
|
||||
earlyTerminated, pipelineAggregators(), metadata);
|
||||
earlyTerminated, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,11 +29,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
|
@ -48,9 +46,9 @@ public class FilterAggregator extends BucketsAggregator implements SingleBucketA
|
|||
Supplier<Weight> filter,
|
||||
AggregatorFactories factories,
|
||||
SearchContext context,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Aggregator parent,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
|
@ -71,13 +69,12 @@ public class FilterAggregator extends BucketsAggregator implements SingleBucketA
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalFilter(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalFilter(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalFilter(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalFilter(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,9 @@ import org.elasticsearch.search.aggregations.AggregationInitializationException;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class FilterAggregatorFactory extends AggregatorFactory {
|
||||
|
@ -72,9 +70,8 @@ public class FilterAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -123,9 +122,8 @@ public class FiltersAggregator extends BucketsAggregator {
|
|||
private final int totalNumKeys;
|
||||
|
||||
public FiltersAggregator(String name, AggregatorFactories factories, String[] keys, Supplier<Weight[]> filters, boolean keyed,
|
||||
String otherBucketKey, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
String otherBucketKey, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.keyed = keyed;
|
||||
this.keys = keys;
|
||||
this.filters = filters;
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator.KeyedFilter;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -89,10 +88,9 @@ public class FiltersAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new FiltersAggregator(name, factories, keys, () -> getWeights(searchContext), keyed,
|
||||
otherBucket ? otherBucketKey : null, searchContext, parent, pipelineAggregators, metadata);
|
||||
otherBucket ? otherBucketKey : null, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,16 +22,13 @@ package org.elasticsearch.search.aggregations.bucket.filter;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InternalFilter extends InternalSingleBucketAggregation implements Filter {
|
||||
InternalFilter(String name, long docCount, InternalAggregations subAggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, subAggregations, pipelineAggregators, metadata);
|
||||
InternalFilter(String name, long docCount, InternalAggregations subAggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, subAggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,6 +45,6 @@ public class InternalFilter extends InternalSingleBucketAggregation implements F
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalFilter(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalFilter(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -49,8 +48,8 @@ public abstract class GeoGridAggregator<T extends InternalGeoGrid> extends Bucke
|
|||
|
||||
GeoGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
|
||||
int requiredSize, int shardSize, SearchContext aggregationContext,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.requiredSize = requiredSize;
|
||||
this.shardSize = shardSize;
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
|
|||
|
||||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -35,10 +34,8 @@ public class GeoHashGridAggregator extends GeoGridAggregator<InternalGeoHashGrid
|
|||
|
||||
GeoHashGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
|
||||
int requiredSize, int shardSize, SearchContext aggregationContext,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent,
|
||||
pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -27,14 +27,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
@ -60,10 +58,9 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
@ -76,13 +73,12 @@ public class GeoHashGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, Geohash::longEncode);
|
||||
return new GeoHashGridAggregator(name, factories, cellIdSource, requiredSize, shardSize,
|
||||
searchContext, parent, pipelineAggregators, metadata);
|
||||
searchContext, parent, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.bucket.geogrid;
|
|||
|
||||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -36,10 +35,8 @@ public class GeoTileGridAggregator extends GeoGridAggregator<InternalGeoTileGrid
|
|||
|
||||
GeoTileGridAggregator(String name, AggregatorFactories factories, CellIdSource valuesSource,
|
||||
int requiredSize, int shardSize, SearchContext aggregationContext,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent,
|
||||
pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, valuesSource, requiredSize, shardSize, aggregationContext, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
|
@ -34,7 +33,6 @@ import org.elasticsearch.search.internal.SearchContext;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.GeoPoint> {
|
||||
|
@ -58,10 +56,9 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
@ -74,13 +71,12 @@ public class GeoTileGridAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
CellIdSource cellIdSource = new CellIdSource(valuesSource, precision, geoBoundingBox, GeoTileUtils::longEncode);
|
||||
return new GeoTileGridAggregator(name, factories, cellIdSource, requiredSize, shardSize,
|
||||
searchContext, parent, pipelineAggregators, metadata);
|
||||
searchContext, parent, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,18 +25,16 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GlobalAggregator extends BucketsAggregator implements SingleBucketAggregator {
|
||||
|
||||
public GlobalAggregator(String name, AggregatorFactories subFactories, SearchContext aggregationContext,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, subFactories, aggregationContext, null, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, subFactories, aggregationContext, null, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -54,8 +52,7 @@ public class GlobalAggregator extends BucketsAggregator implements SingleBucketA
|
|||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
assert owningBucketOrdinal == 0 : "global aggregator can only be a top level aggregator";
|
||||
return new InternalGlobal(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), pipelineAggregators(),
|
||||
metadata());
|
||||
return new InternalGlobal(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,11 +24,9 @@ import org.elasticsearch.search.aggregations.AggregationExecutionException;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GlobalAggregatorFactory extends AggregatorFactory {
|
||||
|
@ -45,7 +43,6 @@ public class GlobalAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (parent != null) {
|
||||
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) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
return new GlobalAggregator(name, factories, searchContext, pipelineAggregators, metadata);
|
||||
return new GlobalAggregator(name, factories, searchContext, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,10 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.global;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -32,9 +30,8 @@ import java.util.Map;
|
|||
* regardless the query.
|
||||
*/
|
||||
public class InternalGlobal extends InternalSingleBucketAggregation implements Global {
|
||||
InternalGlobal(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
InternalGlobal(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,6 +48,6 @@ public class InternalGlobal extends InternalSingleBucketAggregation implements G
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalGlobal(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalGlobal(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
|
|||
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -66,9 +65,9 @@ class AutoDateHistogramAggregator extends DeferableBucketAggregator {
|
|||
|
||||
AutoDateHistogramAggregator(String name, AggregatorFactories factories, int numBuckets, RoundingInfo[] roundingInfos,
|
||||
@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.valuesSource = valuesSource;
|
||||
this.formatter = formatter;
|
||||
|
@ -185,16 +184,14 @@ class AutoDateHistogramAggregator extends DeferableBucketAggregator {
|
|||
InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx,
|
||||
buildEmptySubAggregations());
|
||||
|
||||
return new InternalAutoDateHistogram(name, buckets, targetBuckets, emptyBucketInfo,
|
||||
formatter, pipelineAggregators(), metadata(), 1);
|
||||
return new InternalAutoDateHistogram(name, buckets, targetBuckets, emptyBucketInfo, formatter, metadata(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
InternalAutoDateHistogram.BucketInfo emptyBucketInfo = new InternalAutoDateHistogram.BucketInfo(roundingInfos, roundingIdx,
|
||||
buildEmptySubAggregations());
|
||||
return new InternalAutoDateHistogram(name, Collections.emptyList(), targetBuckets, emptyBucketInfo, formatter,
|
||||
pipelineAggregators(), metadata(), 1);
|
||||
return new InternalAutoDateHistogram(name, Collections.emptyList(), targetBuckets, emptyBucketInfo, formatter, metadata(), 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
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.Numeric;
|
||||
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 java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class AutoDateHistogramAggregatorFactory
|
||||
|
@ -59,28 +57,25 @@ public final class AutoDateHistogramAggregatorFactory
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
return createAggregator(valuesSource, searchContext, parent, pipelineAggregators, metadata);
|
||||
return createAggregator(valuesSource, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
private Aggregator createAggregator(ValuesSource.Numeric valuesSource,
|
||||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new AutoDateHistogramAggregator(name, factories, numBuckets, roundingInfos,
|
||||
valuesSource, config.format(), searchContext, parent, pipelineAggregators, metadata);
|
||||
valuesSource, config.format(), searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return createAggregator(null, searchContext, parent, pipelineAggregators, metadata);
|
||||
return createAggregator(null, searchContext, parent, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -68,9 +67,9 @@ class DateHistogramAggregator extends BucketsAggregator {
|
|||
BucketOrder order, boolean keyed,
|
||||
long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Numeric valuesSource,
|
||||
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.shardRounding = shardRounding;
|
||||
this.order = order;
|
||||
|
|
|
@ -26,18 +26,15 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class DateHistogramAggregatorFactory
|
||||
extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
public final class DateHistogramAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
|
||||
private final BucketOrder order;
|
||||
private final boolean keyed;
|
||||
|
@ -78,20 +75,19 @@ public final class DateHistogramAggregatorFactory
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
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) {
|
||||
ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource;
|
||||
if (rangeValueSource.rangeType() != RangeType.DATE) {
|
||||
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 {
|
||||
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,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
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,
|
||||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return createAggregator(null, searchContext, parent, pipelineAggregators, metadata);
|
||||
return createAggregator(null, searchContext, parent, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -71,10 +70,9 @@ class DateRangeHistogramAggregator extends BucketsAggregator {
|
|||
BucketOrder order, boolean keyed,
|
||||
long minDocCount, @Nullable ExtendedBounds extendedBounds, @Nullable ValuesSource.Range valuesSource,
|
||||
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.shardRounding = shardRounding;
|
||||
this.order = order;
|
||||
|
|
|
@ -24,14 +24,12 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -87,14 +85,13 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
if (valuesSource instanceof ValuesSource.Numeric) {
|
||||
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) {
|
||||
ValuesSource.Range rangeValueSource = (ValuesSource.Range) valuesSource;
|
||||
if (rangeValueSource.rangeType().isNumeric() == false) {
|
||||
|
@ -102,8 +99,7 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
|
|||
+ rangeValueSource.rangeType().name + "]");
|
||||
}
|
||||
return new RangeHistogramAggregator(name, factories, interval, offset, order, keyed, minDocCount, minBound, maxBound,
|
||||
(ValuesSource.Range) valuesSource, config.format(), searchContext, parent, pipelineAggregators,
|
||||
metadata);
|
||||
(ValuesSource.Range) valuesSource, config.format(), searchContext, parent, metadata);
|
||||
}
|
||||
else {
|
||||
throw new IllegalArgumentException("Expected one of [Numeric, Range] values source, found ["
|
||||
|
@ -114,9 +110,8 @@ public final class HistogramAggregatorFactory extends ValuesSourceAggregatorFact
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
|||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.bucket.MultiBucketsAggregation;
|
||||
import org.elasticsearch.search.aggregations.bucket.histogram.AutoDateHistogramAggregationBuilder.RoundingInfo;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
|
@ -200,8 +199,8 @@ public final class InternalAutoDateHistogram extends
|
|||
private long bucketInnerInterval;
|
||||
|
||||
InternalAutoDateHistogram(String name, List<Bucket> buckets, int targetBuckets, BucketInfo emptyBucketInfo, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata, long bucketInnerInterval) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata, long bucketInnerInterval) {
|
||||
super(name, metadata);
|
||||
this.buckets = buckets;
|
||||
this.bucketInfo = emptyBucketInfo;
|
||||
this.format = formatter;
|
||||
|
@ -259,7 +258,7 @@ public final class InternalAutoDateHistogram extends
|
|||
|
||||
@Override
|
||||
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
|
||||
|
@ -517,7 +516,7 @@ public final class InternalAutoDateHistogram extends
|
|||
this.bucketInfo.emptySubAggregations);
|
||||
|
||||
return new InternalAutoDateHistogram(getName(), reducedBucketsResult.buckets, targetBuckets, bucketInfo, format,
|
||||
pipelineAggregators(), getMetadata(), reducedBucketsResult.innerInterval);
|
||||
getMetadata(), reducedBucketsResult.innerInterval);
|
||||
}
|
||||
|
||||
private BucketReduceResult maybeMergeConsecutiveBuckets(BucketReduceResult reducedBucketsResult,
|
||||
|
@ -594,7 +593,7 @@ public final class InternalAutoDateHistogram extends
|
|||
buckets2.add((Bucket) b);
|
||||
}
|
||||
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
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -66,10 +65,9 @@ class NumericHistogramAggregator extends BucketsAggregator {
|
|||
NumericHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset,
|
||||
BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound,
|
||||
@Nullable ValuesSource.Numeric valuesSource, DocValueFormat formatter,
|
||||
SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
if (interval <= 0) {
|
||||
throw new IllegalArgumentException("interval must be positive, got: " + interval);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -60,10 +59,9 @@ public class RangeHistogramAggregator extends BucketsAggregator {
|
|||
RangeHistogramAggregator(String name, AggregatorFactories factories, double interval, double offset,
|
||||
BucketOrder order, boolean keyed, long minDocCount, double minBound, double maxBound,
|
||||
@Nullable ValuesSource.Range valuesSource, DocValueFormat formatter,
|
||||
SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
if (interval <= 0) {
|
||||
throw new IllegalArgumentException("interval must be positive, got: " + interval);
|
||||
}
|
||||
|
|
|
@ -21,16 +21,13 @@ package org.elasticsearch.search.aggregations.bucket.missing;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class InternalMissing extends InternalSingleBucketAggregation implements Missing {
|
||||
InternalMissing(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
InternalMissing(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,6 +44,6 @@ public class InternalMissing extends InternalSingleBucketAggregation implements
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalMissing(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalMissing(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,12 +27,10 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MissingAggregator extends BucketsAggregator implements SingleBucketAggregator {
|
||||
|
@ -40,9 +38,8 @@ public class MissingAggregator extends BucketsAggregator implements SingleBucket
|
|||
private final ValuesSource valuesSource;
|
||||
|
||||
public MissingAggregator(String name, AggregatorFactories factories, ValuesSource valuesSource,
|
||||
SearchContext aggregationContext, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata);
|
||||
SearchContext aggregationContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
}
|
||||
|
||||
|
@ -72,13 +69,12 @@ public class MissingAggregator extends BucketsAggregator implements SingleBucket
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal),
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalMissing(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalMissing(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalMissing(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,14 +23,12 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
|
@ -43,9 +41,8 @@ public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<Valu
|
|||
@Override
|
||||
protected MissingAggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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
|
||||
|
@ -53,9 +50,8 @@ public class MissingAggregatorFactory extends ValuesSourceAggregatorFactory<Valu
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -21,19 +21,16 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Result of the {@link NestedAggregator}.
|
||||
*/
|
||||
public class InternalNested extends InternalSingleBucketAggregation implements Nested {
|
||||
InternalNested(String name, long docCount, InternalAggregations aggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
InternalNested(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,6 +47,6 @@ public class InternalNested extends InternalSingleBucketAggregation implements N
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalNested(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalNested(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,19 +21,16 @@ package org.elasticsearch.search.aggregations.bucket.nested;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Result of the {@link ReverseNestedAggregator}.
|
||||
*/
|
||||
public class InternalReverseNested extends InternalSingleBucketAggregation implements ReverseNested {
|
||||
public InternalReverseNested(String name, long docCount, InternalAggregations aggregations,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, pipelineAggregators, metadata);
|
||||
public InternalReverseNested(String name, long docCount, InternalAggregations aggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, aggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,6 +47,6 @@ public class InternalReverseNested extends InternalSingleBucketAggregation imple
|
|||
|
||||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount, InternalAggregations subAggregations) {
|
||||
return new InternalReverseNested(name, docCount, subAggregations, pipelineAggregators(), getMetadata());
|
||||
return new InternalReverseNested(name, docCount, subAggregations, getMetadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,11 +42,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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,
|
||||
SearchContext context, Aggregator parentAggregator,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata,
|
||||
boolean collectsFromSingleBucket) throws IOException {
|
||||
super(name, factories, context, parentAggregator, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata, boolean collectsFromSingleBucket) throws IOException {
|
||||
super(name, factories, context, parentAggregator, metadata);
|
||||
|
||||
Query parentFilter = parentObjectMapper != null ? parentObjectMapper.nestedTypeFilter()
|
||||
: Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated());
|
||||
|
@ -126,13 +123,12 @@ public class NestedAggregator extends BucketsAggregator implements SingleBucketA
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal),
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalNested(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
|
||||
class BufferingNestedLeafBucketCollector extends LeafBucketCollectorBase {
|
||||
|
|
|
@ -26,11 +26,9 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class NestedAggregatorFactory extends AggregatorFactory {
|
||||
|
@ -50,13 +48,12 @@ public class NestedAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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,
|
||||
pipelineAggregators, metadata, collectsFromSingleBucket);
|
||||
metadata, collectsFromSingleBucket);
|
||||
}
|
||||
|
||||
private static final class Unmapped extends NonCollectingAggregator {
|
||||
|
@ -64,14 +61,13 @@ public class NestedAggregatorFactory extends AggregatorFactory {
|
|||
Unmapped(String name,
|
||||
SearchContext context,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
super(name, context, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalNested(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,11 +35,9 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.SingleBucketAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReverseNestedAggregator extends BucketsAggregator implements SingleBucketAggregator {
|
||||
|
@ -50,9 +48,9 @@ public class ReverseNestedAggregator extends BucketsAggregator implements Single
|
|||
private final BitSetProducer parentBitsetProducer;
|
||||
|
||||
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 {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
if (objectMapper == null) {
|
||||
parentFilter = Queries.newNonNestedFilter(context.mapperService().getIndexSettings().getIndexVersionCreated());
|
||||
} else {
|
||||
|
@ -94,13 +92,12 @@ public class ReverseNestedAggregator extends BucketsAggregator implements Single
|
|||
|
||||
@Override
|
||||
public InternalAggregation buildAggregation(long owningBucketOrdinal) throws IOException {
|
||||
return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal),
|
||||
pipelineAggregators(), metadata());
|
||||
return new InternalReverseNested(name, bucketDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
|
||||
Query getParentFilter() {
|
||||
|
|
|
@ -26,11 +26,9 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ReverseNestedAggregatorFactory extends AggregatorFactory {
|
||||
|
@ -51,13 +49,12 @@ public class ReverseNestedAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (unmapped) {
|
||||
return new Unmapped(name, searchContext, parent, pipelineAggregators, metadata);
|
||||
return new Unmapped(name, searchContext, parent, metadata);
|
||||
} else {
|
||||
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,
|
||||
SearchContext context,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
super(name, context, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalReverseNested(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range;
|
||||
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.Numeric;
|
||||
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 java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> {
|
||||
|
@ -60,9 +58,8 @@ public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourc
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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
|
||||
|
@ -70,10 +67,9 @@ public class AbstractRangeAggregatorFactory<R extends Range> extends ValuesSourc
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new RangeAggregator(name, factories, valuesSource, config.format(), rangeFactory, ranges, keyed, searchContext, parent,
|
||||
pipelineAggregators, metadata);
|
||||
metadata);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -80,9 +79,8 @@ public final class BinaryRangeAggregator extends BucketsAggregator {
|
|||
public BinaryRangeAggregator(String name, AggregatorFactories factories,
|
||||
ValuesSource.Bytes valuesSource, DocValueFormat format,
|
||||
List<Range> ranges, boolean keyed, SearchContext context,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.format = format;
|
||||
this.keyed = keyed;
|
||||
|
@ -337,11 +335,11 @@ public final class BinaryRangeAggregator extends BucketsAggregator {
|
|||
ranges[i].key, ranges[i].from, ranges[i].to,
|
||||
bucketDocCount(bucketOrd), bucketAggregations(bucketOrd)));
|
||||
}
|
||||
return new InternalBinaryRange(name, format, keyed, buckets, pipelineAggregators(), metadata());
|
||||
return new InternalBinaryRange(name, format, keyed, buckets, metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalBinaryRange(name, format, keyed, emptyList(), pipelineAggregators(), metadata());
|
||||
return new InternalBinaryRange(name, format, keyed, emptyList(), metadata());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories.Builder;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
|
@ -50,21 +49,18 @@ public class BinaryRangeAggregatorFactory
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
protected Aggregator createUnmapped(SearchContext searchContext, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
return new BinaryRangeAggregator(name, factories, null, config.format(),
|
||||
ranges, keyed, searchContext, parent, pipelineAggregators, metadata);
|
||||
ranges, keyed, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Aggregator doCreateInternal(ValuesSource.Bytes valuesSource,
|
||||
SearchContext searchContext, Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new BinaryRangeAggregator(name, factories, valuesSource, config.format(),
|
||||
ranges, keyed, searchContext, parent, pipelineAggregators, metadata);
|
||||
ranges, keyed, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,14 +33,12 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class GeoDistanceRangeAggregatorFactory
|
||||
|
@ -67,10 +65,9 @@ public class GeoDistanceRangeAggregatorFactory
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new RangeAggregator.Unmapped<>(name, ranges, keyed, config.format(), searchContext, parent,
|
||||
rangeFactory, pipelineAggregators, metadata);
|
||||
rangeFactory, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -78,12 +75,10 @@ public class GeoDistanceRangeAggregatorFactory
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
DistanceSource distanceSource = new DistanceSource(valuesSource, distanceType, origin, unit);
|
||||
return new RangeAggregator(name, factories, distanceSource, config.format(), rangeFactory, ranges, keyed, searchContext,
|
||||
parent,
|
||||
pipelineAggregators, metadata);
|
||||
parent, metadata);
|
||||
}
|
||||
|
||||
private static class DistanceSource extends ValuesSource.Numeric {
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.Aggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -192,9 +191,8 @@ public final class InternalBinaryRange
|
|||
protected final boolean keyed;
|
||||
private final List<Bucket> buckets;
|
||||
|
||||
public InternalBinaryRange(String name, DocValueFormat format, boolean keyed, List<Bucket> buckets,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
public InternalBinaryRange(String name, DocValueFormat format, boolean keyed, List<Bucket> buckets, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.format = format;
|
||||
this.keyed = keyed;
|
||||
this.buckets = buckets;
|
||||
|
@ -229,7 +227,7 @@ public final class InternalBinaryRange
|
|||
|
||||
@Override
|
||||
public InternalBinaryRange create(List<Bucket> buckets) {
|
||||
return new InternalBinaryRange(name, format, keyed, buckets, pipelineAggregators(), metadata);
|
||||
return new InternalBinaryRange(name, format, keyed, buckets, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -262,7 +260,7 @@ public final class InternalBinaryRange
|
|||
buckets.add(new Bucket(format, keyed, b.key, b.from, b.to, docCounts[i],
|
||||
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
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
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.internal.SearchContext;
|
||||
|
||||
|
@ -227,9 +226,9 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
|
||||
public RangeAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource, DocValueFormat format,
|
||||
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;
|
||||
this.valuesSource = valuesSource;
|
||||
this.format = format;
|
||||
|
@ -363,10 +362,10 @@ public class RangeAggregator extends BucketsAggregator {
|
|||
private final DocValueFormat format;
|
||||
|
||||
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 {
|
||||
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
super(name, context, parent, metadata);
|
||||
this.ranges = ranges;
|
||||
this.keyed = keyed;
|
||||
this.format = format;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactory;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
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.Numeric;
|
||||
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 java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
|
@ -58,11 +56,10 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -80,8 +77,7 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
if ((execution.needsGlobalOrdinals()) && (!(valuesSource instanceof ValuesSource.Bytes.WithOrdinals))) {
|
||||
execution = ExecutionMode.MAP;
|
||||
}
|
||||
return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, searchContext, parent, pipelineAggregators,
|
||||
metadata);
|
||||
return execution.create(name, factories, shardSize, maxDocsPerValue, valuesSource, searchContext, parent, metadata);
|
||||
}
|
||||
|
||||
throw new AggregationExecutionException("Sampler aggregation cannot be applied to field [" + config.fieldContext().field()
|
||||
|
@ -91,11 +87,10 @@ public class DiversifiedAggregatorFactory extends ValuesSourceAggregatorFactory<
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
|
|
@ -31,12 +31,10 @@ import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -50,10 +48,10 @@ public class DiversifiedBytesHashSamplerAggregator extends SamplerAggregator {
|
|||
private int maxDocsPerValue;
|
||||
|
||||
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,
|
||||
int maxDocsPerValue) throws IOException {
|
||||
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, shardSize, factories, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.maxDocsPerValue = maxDocsPerValue;
|
||||
}
|
||||
|
|
|
@ -33,12 +33,10 @@ import org.elasticsearch.index.fielddata.SortedBinaryDocValues;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -49,9 +47,9 @@ public class DiversifiedMapSamplerAggregator extends SamplerAggregator {
|
|||
private BytesRefHash bucketOrds;
|
||||
|
||||
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 {
|
||||
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, shardSize, factories, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.maxDocsPerValue = maxDocsPerValue;
|
||||
// Need to use super class shardSize since it is limited to maxDoc
|
||||
|
|
|
@ -30,12 +30,10 @@ import org.elasticsearch.index.fielddata.AbstractNumericDocValues;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -45,9 +43,9 @@ public class DiversifiedNumericSamplerAggregator extends SamplerAggregator {
|
|||
private int maxDocsPerValue;
|
||||
|
||||
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 {
|
||||
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, shardSize, factories, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.maxDocsPerValue = maxDocsPerValue;
|
||||
}
|
||||
|
|
|
@ -31,12 +31,10 @@ import org.elasticsearch.index.fielddata.AbstractNumericDocValues;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
|
@ -46,9 +44,9 @@ public class DiversifiedOrdinalsSamplerAggregator extends SamplerAggregator {
|
|||
private int maxDocsPerValue;
|
||||
|
||||
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 {
|
||||
super(name, shardSize, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, shardSize, factories, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.maxDocsPerValue = maxDocsPerValue;
|
||||
}
|
||||
|
|
|
@ -21,10 +21,8 @@ package org.elasticsearch.search.aggregations.bucket.sampler;
|
|||
import org.elasticsearch.common.io.stream.StreamInput;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.bucket.InternalSingleBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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
|
||||
public static final String PARSER_NAME = "sampler";
|
||||
|
||||
InternalSampler(String name, long docCount, InternalAggregations subAggregations, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, docCount, subAggregations, pipelineAggregators, metadata);
|
||||
InternalSampler(String name, long docCount, InternalAggregations subAggregations, Map<String, Object> metadata) {
|
||||
super(name, docCount, subAggregations, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,6 +54,6 @@ public class InternalSampler extends InternalSingleBucketAggregation implements
|
|||
@Override
|
||||
protected InternalSingleBucketAggregation newAggregation(String name, long docCount,
|
||||
InternalAggregations subAggregations) {
|
||||
return new InternalSampler(name, docCount, subAggregations, pipelineAggregators(), metadata);
|
||||
return new InternalSampler(name, docCount, subAggregations, metadata);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,13 +33,11 @@ import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
|||
import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -66,10 +64,9 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
|
|||
|
||||
@Override
|
||||
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
|
||||
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
SearchContext context, Aggregator parent, 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,
|
||||
maxDocsPerValue);
|
||||
}
|
||||
|
@ -84,11 +81,9 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
|
|||
|
||||
@Override
|
||||
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
|
||||
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
|
||||
return new DiversifiedBytesHashSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators,
|
||||
metadata,
|
||||
return new DiversifiedBytesHashSamplerAggregator(name, shardSize, factories, context, parent, metadata,
|
||||
valuesSource,
|
||||
maxDocsPerValue);
|
||||
}
|
||||
|
@ -103,9 +98,8 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
|
|||
|
||||
@Override
|
||||
Aggregator create(String name, AggregatorFactories factories, int shardSize, int maxDocsPerValue, ValuesSource valuesSource,
|
||||
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
return new DiversifiedOrdinalsSamplerAggregator(name, shardSize, factories, context, parent, pipelineAggregators, metadata,
|
||||
SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
return new DiversifiedOrdinalsSamplerAggregator(name, shardSize, factories, context, parent, metadata,
|
||||
(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,
|
||||
ValuesSource valuesSource, SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
ValuesSource valuesSource, SearchContext context, Aggregator parent, Map<String, Object> metadata) throws IOException;
|
||||
|
||||
abstract boolean needsGlobalOrdinals();
|
||||
|
||||
|
@ -148,8 +141,8 @@ public class SamplerAggregator extends DeferableBucketAggregator implements Sing
|
|||
protected BestDocsDeferringCollector bdd;
|
||||
|
||||
SamplerAggregator(String name, int shardSize, AggregatorFactories factories, SearchContext context,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
// Make sure we do not allow size > maxDoc, to prevent accidental OOM
|
||||
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 {
|
||||
runDeferredCollections(owningBucketOrdinal);
|
||||
return new InternalSampler(name, bdd == null ? 0 : bdd.getDocCount(owningBucketOrdinal), bucketAggregations(owningBucketOrdinal),
|
||||
pipelineAggregators(),
|
||||
metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return new InternalSampler(name, 0, buildEmptySubAggregations(), pipelineAggregators(), metadata());
|
||||
return new InternalSampler(name, 0, buildEmptySubAggregations(), metadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,11 +23,9 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SamplerAggregatorFactory extends AggregatorFactory {
|
||||
|
@ -44,9 +42,8 @@ public class SamplerAggregatorFactory extends AggregatorFactory {
|
|||
public Aggregator createInternal(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.aggregations.Aggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -32,8 +31,8 @@ import java.util.Map;
|
|||
public class UnmappedSampler extends InternalSampler {
|
||||
public static final String NAME = "unmapped_sampler";
|
||||
|
||||
UnmappedSampler(String name, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, 0, InternalAggregations.EMPTY, pipelineAggregators, metadata);
|
||||
UnmappedSampler(String name, Map<String, Object> metadata) {
|
||||
super(name, 0, InternalAggregations.EMPTY, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -50,7 +49,7 @@ public class UnmappedSampler extends InternalSampler {
|
|||
|
||||
@Override
|
||||
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
|
||||
return new UnmappedSampler(name, pipelineAggregators(), metadata);
|
||||
return new UnmappedSampler(name, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.terms.GlobalOrdinalsStringTermsAggregator;
|
||||
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.internal.ContextIndexSearcher;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
@ -62,10 +60,9 @@ public class GlobalOrdinalsSignificantTermsAggregator extends GlobalOrdinalsStri
|
|||
boolean forceRemapGlobalOrds,
|
||||
SignificanceHeuristic significanceHeuristic,
|
||||
SignificantTermsAggregatorFactory termsAggFactory,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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.termsAggFactory = termsAggFactory;
|
||||
this.numCollectedDocs = 0;
|
||||
|
|
|
@ -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.terms.IncludeExclude;
|
||||
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.internal.ContextIndexSearcher;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
@ -46,11 +44,10 @@ public class SignificantLongTermsAggregator extends LongTermsAggregator {
|
|||
public SignificantLongTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Numeric valuesSource,
|
||||
DocValueFormat format, BucketCountThresholds bucketCountThresholds, SearchContext context, Aggregator parent,
|
||||
SignificanceHeuristic significanceHeuristic, SignificantTermsAggregatorFactory termsAggFactory,
|
||||
IncludeExclude.LongFilter includeExclude,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
IncludeExclude.LongFilter includeExclude, Map<String, Object> metadata) throws IOException {
|
||||
|
||||
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.termsAggFactory = termsAggFactory;
|
||||
}
|
||||
|
|
|
@ -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.terms.IncludeExclude;
|
||||
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.internal.ContextIndexSearcher;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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,
|
||||
BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude, SearchContext aggregationContext,
|
||||
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,
|
||||
SubAggCollectionMode.BREADTH_FIRST, false, pipelineAggregators, metadata);
|
||||
SubAggCollectionMode.BREADTH_FIRST, false, metadata);
|
||||
this.significanceHeuristic = significanceHeuristic;
|
||||
this.termsAggFactory = termsAggFactory;
|
||||
}
|
||||
|
|
|
@ -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.TermsAggregator;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource>
|
||||
|
@ -164,11 +162,10 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new UnmappedSignificantTerms(name, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, pipelineAggregators, metadata) {
|
||||
return new NonCollectingAggregator(name, searchContext, parent, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
@ -181,7 +178,6 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
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,
|
||||
significanceHeuristic, this, pipelineAggregators, metadata);
|
||||
significanceHeuristic, this, metadata);
|
||||
}
|
||||
|
||||
if ((includeExclude != null) && (includeExclude.isRegexBased())) {
|
||||
|
@ -245,8 +241,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
longFilter = includeExclude.convertToLongFilter(config.format());
|
||||
}
|
||||
return new SignificantLongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(),
|
||||
bucketCountThresholds, searchContext, parent, significanceHeuristic, this, longFilter, pipelineAggregators,
|
||||
metadata);
|
||||
bucketCountThresholds, searchContext, parent, significanceHeuristic, this, longFilter, metadata);
|
||||
}
|
||||
|
||||
throw new AggregationExecutionException("significant_terms aggregation cannot be applied to field ["
|
||||
|
@ -268,12 +263,11 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
Aggregator parent,
|
||||
SignificanceHeuristic significanceHeuristic,
|
||||
SignificantTermsAggregatorFactory termsAggregatorFactory,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
|
||||
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,
|
||||
SignificanceHeuristic significanceHeuristic,
|
||||
SignificantTermsAggregatorFactory termsAggregatorFactory,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
final IncludeExclude.OrdinalsFilter filter = includeExclude == null ? null : includeExclude.convertToOrdinalsFilter(format);
|
||||
|
@ -309,8 +302,7 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
}
|
||||
return new GlobalOrdinalsSignificantTermsAggregator(name, factories,
|
||||
(ValuesSource.Bytes.WithOrdinals.FieldData) valuesSource, format, bucketCountThresholds, filter,
|
||||
aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, pipelineAggregators,
|
||||
metadata);
|
||||
aggregationContext, parent, remapGlobalOrd, significanceHeuristic, termsAggregatorFactory, metadata);
|
||||
|
||||
}
|
||||
};
|
||||
|
@ -343,7 +335,6 @@ public class SignificantTermsAggregatorFactory extends ValuesSourceAggregatorFac
|
|||
Aggregator parent,
|
||||
SignificanceHeuristic significanceHeuristic,
|
||||
SignificantTermsAggregatorFactory termsAggregatorFactory,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -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.StringFilter;
|
||||
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.SearchContext;
|
||||
import org.elasticsearch.search.lookup.SourceLookup;
|
||||
|
@ -72,12 +71,12 @@ public class SignificantTextAggregator extends BucketsAggregator {
|
|||
|
||||
|
||||
public SignificantTextAggregator(String name, AggregatorFactories factories,
|
||||
SearchContext context, Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
SearchContext context, Aggregator parent,
|
||||
BucketCountThresholds bucketCountThresholds, IncludeExclude.StringFilter includeExclude,
|
||||
SignificanceHeuristic significanceHeuristic, SignificantTextAggregatorFactory termsAggFactory,
|
||||
String fieldName, String [] sourceFieldNames, boolean filterDuplicateText,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.bucketCountThresholds = bucketCountThresholds;
|
||||
this.includeExclude = includeExclude;
|
||||
this.significanceHeuristic = significanceHeuristic;
|
||||
|
|
|
@ -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.TermsAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregator.BucketCountThresholds;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class SignificantTextAggregatorFactory extends AggregatorFactory
|
||||
|
@ -165,8 +163,7 @@ public class SignificantTextAggregatorFactory extends AggregatorFactory
|
|||
|
||||
@Override
|
||||
protected Aggregator createInternal(SearchContext searchContext, Aggregator parent, boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata)
|
||||
throws IOException {
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
}
|
||||
|
@ -191,7 +188,7 @@ public class SignificantTextAggregatorFactory extends AggregatorFactory
|
|||
IncludeExclude.StringFilter incExcFilter = includeExclude == null ? null:
|
||||
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);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,12 +29,10 @@ import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
|
|||
import org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.bucket.MergingBucketsDeferringCollector;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -53,10 +51,9 @@ public abstract class AbstractRareTermsAggregator<T extends ValuesSource,
|
|||
final SetBackedScalingCuckooFilter filter;
|
||||
|
||||
AbstractRareTermsAggregator(String name, AggregatorFactories factories, SearchContext context,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, long maxDocCount, double precision,
|
||||
Aggregator parent, Map<String, Object> metadata, long maxDocCount, double precision,
|
||||
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
|
||||
this.filter = new SetBackedScalingCuckooFilter(10000, new Random(context.indexShard().shardId().hashCode()), precision);
|
||||
|
|
|
@ -24,11 +24,9 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
|
@ -39,8 +37,8 @@ abstract class AbstractStringTermsAggregator extends TermsAggregator {
|
|||
|
||||
AbstractStringTermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
|
||||
BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds, SubAggCollectionMode subAggCollectMode,
|
||||
boolean showTermDocCountError, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators, metadata);
|
||||
boolean showTermDocCountError, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, bucketCountThresholds, order, format, subAggCollectMode, metadata);
|
||||
this.showTermDocCountError = showTermDocCountError;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource.Numeric;
|
||||
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,
|
||||
BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent,
|
||||
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,
|
||||
showTermDocCountError, longFilter, pipelineAggregators, metadata);
|
||||
showTermDocCountError, longFilter, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -41,13 +41,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.LongUnaryOperator;
|
||||
|
||||
|
@ -88,10 +86,8 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
|
|||
boolean remapGlobalOrds,
|
||||
SubAggCollectionMode collectionMode,
|
||||
boolean showTermDocCountError,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError,
|
||||
pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.includeExclude = includeExclude;
|
||||
final IndexReader reader = context.searcher().getIndexReader();
|
||||
|
@ -312,10 +308,9 @@ public class GlobalOrdinalsStringTermsAggregator extends AbstractStringTermsAggr
|
|||
boolean forceDenseMode,
|
||||
SubAggCollectionMode collectionMode,
|
||||
boolean showTermDocCountError,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
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;
|
||||
this.segmentDocCounts = context.bigArrays().newIntArray(1, true);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.AggregationExecutionException;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -52,10 +51,9 @@ public abstract class InternalMappedRareTerms<A extends InternalRareTerms<A, B>,
|
|||
|
||||
protected final Logger logger = LogManager.getLogger(getClass());
|
||||
|
||||
InternalMappedRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, DocValueFormat format,
|
||||
InternalMappedRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
|
||||
List<B> buckets, long maxDocCount, SetBackedScalingCuckooFilter filter) {
|
||||
super(name, order, maxDocCount, pipelineAggregators, metadata);
|
||||
super(name, order, maxDocCount, metadata);
|
||||
this.format = format;
|
||||
this.buckets = buckets;
|
||||
this.filter = filter;
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.InternalAggregations;
|
|||
import org.elasticsearch.search.aggregations.InternalMultiBucketAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.KeyComparable;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -122,9 +121,8 @@ public abstract class InternalRareTerms<A extends InternalRareTerms<A, B>, B ext
|
|||
protected final BucketOrder order;
|
||||
protected final long maxDocCount;
|
||||
|
||||
protected InternalRareTerms(String name, BucketOrder order, long maxDocCount,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
protected InternalRareTerms(String name, BucketOrder order, long maxDocCount, Map<String, Object> metadata) {
|
||||
super(name, metadata);
|
||||
this.order = order;
|
||||
this.maxDocCount = maxDocCount;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -100,10 +99,9 @@ public class LongRareTerms extends InternalMappedRareTerms<LongRareTerms, LongRa
|
|||
}
|
||||
}
|
||||
|
||||
LongRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, DocValueFormat format,
|
||||
LongRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
|
||||
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
|
||||
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
|
||||
|
@ -130,8 +128,7 @@ public class LongRareTerms extends InternalMappedRareTerms<LongRareTerms, LongRa
|
|||
|
||||
@Override
|
||||
protected LongRareTerms createWithFilter(String name, List<LongRareTerms.Bucket> buckets, SetBackedScalingCuckooFilter filter) {
|
||||
return new LongRareTerms(name, order, pipelineAggregators(), getMetadata(), format,
|
||||
buckets, maxDocCount, filter);
|
||||
return new LongRareTerms(name, order, getMetadata(), format, buckets, maxDocCount, filter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
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,
|
||||
SearchContext aggregationContext, Aggregator parent, IncludeExclude.LongFilter longFilter,
|
||||
int maxDocCount, double precision, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, pipelineAggregators, metadata, maxDocCount, precision,
|
||||
format, valuesSource, longFilter);
|
||||
int maxDocCount, double precision, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, metadata, maxDocCount, precision, format, valuesSource, longFilter);
|
||||
this.bucketOrds = new LongHash(1, aggregationContext.bigArrays());
|
||||
}
|
||||
|
||||
|
@ -151,12 +148,12 @@ public class LongRareTermsAggregator extends AbstractRareTermsAggregator<ValuesS
|
|||
}
|
||||
|
||||
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
|
||||
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
|
||||
|
|
|
@ -32,13 +32,11 @@ import org.elasticsearch.search.aggregations.InternalOrder;
|
|||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.IncludeExclude.LongFilter;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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,
|
||||
BucketOrder order, BucketCountThresholds bucketCountThresholds, SearchContext aggregationContext, Aggregator parent,
|
||||
SubAggCollectionMode subAggCollectMode, boolean showTermDocCountError, IncludeExclude.LongFilter longFilter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, pipelineAggregators,
|
||||
metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, aggregationContext, parent, bucketCountThresholds, order, format, subAggCollectMode, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.showTermDocCountError = showTermDocCountError;
|
||||
this.longFilter = longFilter;
|
||||
|
|
|
@ -29,14 +29,12 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.AggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
|
@ -58,10 +56,9 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new UnmappedRareTerms(name, pipelineAggregators, metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) {
|
||||
final InternalAggregation aggregation = new UnmappedRareTerms(name, metadata);
|
||||
return new NonCollectingAggregator(name, searchContext, parent, factories, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
@ -74,7 +71,6 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
|
@ -90,7 +86,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
}
|
||||
|
||||
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())) {
|
||||
|
@ -108,7 +104,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
longFilter = includeExclude.convertToLongFilter(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()
|
||||
|
@ -123,12 +119,11 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource,
|
||||
DocValueFormat format, IncludeExclude includeExclude,
|
||||
SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, long maxDocCount, double precision)
|
||||
throws IOException {
|
||||
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
|
||||
return new StringRareTermsAggregator(name, factories, (ValuesSource.Bytes) valuesSource, format, filter,
|
||||
context, parent, pipelineAggregators, metadata, maxDocCount, precision);
|
||||
context, parent, metadata, maxDocCount, precision);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -155,8 +150,7 @@ public class RareTermsAggregatorFactory extends ValuesSourceAggregatorFactory<Va
|
|||
|
||||
abstract Aggregator create(String name, AggregatorFactories factories, ValuesSource valuesSource,
|
||||
DocValueFormat format, IncludeExclude includeExclude,
|
||||
SearchContext context, Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata,
|
||||
SearchContext context, Aggregator parent, Map<String, Object> metadata,
|
||||
long maxDocCount, double precision)
|
||||
throws IOException;
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.BucketOrder;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
@ -102,10 +101,9 @@ public class StringRareTerms extends InternalMappedRareTerms<StringRareTerms, St
|
|||
}
|
||||
}
|
||||
|
||||
StringRareTerms(String name, BucketOrder order, List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata, DocValueFormat format,
|
||||
StringRareTerms(String name, BucketOrder order, Map<String, Object> metadata, DocValueFormat format,
|
||||
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
|
||||
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
|
||||
|
@ -133,8 +131,7 @@ public class StringRareTerms extends InternalMappedRareTerms<StringRareTerms, St
|
|||
@Override
|
||||
protected StringRareTerms createWithFilter(String name, List<StringRareTerms.Bucket> buckets,
|
||||
SetBackedScalingCuckooFilter filterFilter) {
|
||||
return new StringRareTerms(name, order, pipelineAggregators(), metadata, format,
|
||||
buckets, maxDocCount, filterFilter);
|
||||
return new StringRareTerms(name, order, metadata, format, buckets, maxDocCount, filterFilter);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.AggregatorFactories;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
|
@ -50,9 +49,9 @@ public class StringRareTermsAggregator extends AbstractRareTermsAggregator<Value
|
|||
|
||||
StringRareTermsAggregator(String name, AggregatorFactories factories, ValuesSource.Bytes valuesSource,
|
||||
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 {
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -156,12 +155,12 @@ public class StringRareTermsAggregator extends AbstractRareTermsAggregator<Value
|
|||
}
|
||||
|
||||
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
|
||||
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
|
||||
|
|
|
@ -33,13 +33,11 @@ import org.elasticsearch.search.aggregations.InternalAggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalOrder;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -55,10 +53,9 @@ public class StringTermsAggregator extends AbstractStringTermsAggregator {
|
|||
BucketOrder order, DocValueFormat format, BucketCountThresholds bucketCountThresholds,
|
||||
IncludeExclude.StringFilter includeExclude, SearchContext context,
|
||||
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,
|
||||
pipelineAggregators, metadata);
|
||||
super(name, factories, context, parent, order, format, bucketCountThresholds, collectionMode, showTermDocCountError, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.includeExclude = includeExclude;
|
||||
bucketOrds = new BytesRefHash(1, context.bigArrays());
|
||||
|
|
|
@ -34,14 +34,12 @@ import org.elasticsearch.search.aggregations.InternalOrder.Aggregation;
|
|||
import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder;
|
||||
import org.elasticsearch.search.aggregations.bucket.DeferableBucketAggregator;
|
||||
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.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
@ -180,8 +178,8 @@ public abstract class TermsAggregator extends DeferableBucketAggregator {
|
|||
|
||||
public TermsAggregator(String name, AggregatorFactories factories, SearchContext context, Aggregator parent,
|
||||
BucketCountThresholds bucketCountThresholds, BucketOrder order, DocValueFormat format, SubAggCollectionMode collectMode,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, factories, context, parent, metadata);
|
||||
this.bucketCountThresholds = bucketCountThresholds;
|
||||
this.order = order;
|
||||
partiallyBuiltBucketComparator = order == null ? null : order.partiallyBuiltBucketComparator(b -> b.bucketOrd, this);
|
||||
|
|
|
@ -37,14 +37,12 @@ import org.elasticsearch.search.aggregations.InternalOrder.CompoundOrder;
|
|||
import org.elasticsearch.search.aggregations.NonCollectingAggregator;
|
||||
import org.elasticsearch.search.aggregations.bucket.BucketUtils;
|
||||
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.ValuesSourceAggregatorFactory;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSourceConfig;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource> {
|
||||
|
@ -59,6 +57,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
private final TermsAggregator.BucketCountThresholds bucketCountThresholds;
|
||||
private final boolean showTermDocCountError;
|
||||
|
||||
|
||||
TermsAggregatorFactory(String name,
|
||||
ValuesSourceConfig<ValuesSource> config,
|
||||
BucketOrder order,
|
||||
|
@ -83,11 +82,10 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final InternalAggregation aggregation = new UnmappedTerms(name, order, bucketCountThresholds.getRequiredSize(),
|
||||
bucketCountThresholds.getMinDocCount(), metadata);
|
||||
Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, pipelineAggregators, metadata) {
|
||||
Aggregator agg = new NonCollectingAggregator(name, searchContext, parent, factories, metadata) {
|
||||
@Override
|
||||
public InternalAggregation buildEmptyAggregation() {
|
||||
return aggregation;
|
||||
|
@ -114,7 +112,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
if (collectsFromSingleBucket == false) {
|
||||
return asMultiBucketAggregator(this, searchContext, parent);
|
||||
|
@ -157,7 +154,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
}
|
||||
|
||||
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())) {
|
||||
|
@ -181,15 +178,13 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
longFilter = includeExclude.convertToDoubleFilter();
|
||||
}
|
||||
return new DoubleTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order,
|
||||
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter,
|
||||
pipelineAggregators, metadata);
|
||||
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, metadata);
|
||||
}
|
||||
if (includeExclude != null) {
|
||||
longFilter = includeExclude.convertToLongFilter(config.format());
|
||||
}
|
||||
return new LongTermsAggregator(name, factories, (ValuesSource.Numeric) valuesSource, config.format(), order,
|
||||
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, pipelineAggregators,
|
||||
metadata);
|
||||
bucketCountThresholds, searchContext, parent, cm, showTermDocCountError, longFilter, metadata);
|
||||
}
|
||||
|
||||
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,
|
||||
SubAggCollectionMode subAggCollectMode,
|
||||
boolean showTermDocCountError,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
final IncludeExclude.StringFilter filter = includeExclude == null ? null : includeExclude.convertToStringFilter(format);
|
||||
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")) {
|
||||
|
@ -259,7 +253,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
SearchContext context, Aggregator parent,
|
||||
SubAggCollectionMode subAggCollectMode,
|
||||
boolean showTermDocCountError,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
|
||||
final long maxOrd = getMaxOrd(valuesSource, context.searcher());
|
||||
|
@ -286,7 +279,7 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
*/
|
||||
return new GlobalOrdinalsStringTermsAggregator.LowCardinality(name, factories,
|
||||
ordinalsValuesSource, order, format, bucketCountThresholds, context, parent, false,
|
||||
subAggCollectMode, showTermDocCountError, pipelineAggregators, metadata);
|
||||
subAggCollectMode, showTermDocCountError, metadata);
|
||||
|
||||
}
|
||||
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,
|
||||
format, bucketCountThresholds, filter, context, parent, remapGlobalOrds, subAggCollectMode, showTermDocCountError,
|
||||
pipelineAggregators, metadata);
|
||||
metadata);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -344,7 +337,6 @@ public class TermsAggregatorFactory extends ValuesSourceAggregatorFactory<Values
|
|||
Aggregator parent,
|
||||
SubAggCollectionMode subAggCollectMode,
|
||||
boolean showTermDocCountError,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) throws IOException;
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregations;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
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) {
|
||||
super(name, LongRareTermsAggregator.ORDER, 0, pipelineAggregators, metadata);
|
||||
UnmappedRareTerms(String name, Map<String, Object> metadata) {
|
||||
super(name, LongRareTermsAggregator.ORDER, 0, metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,7 +73,7 @@ public class UnmappedRareTerms extends InternalRareTerms<UnmappedRareTerms, Unma
|
|||
|
||||
@Override
|
||||
public UnmappedRareTerms create(List<UnmappedRareTerms.Bucket> buckets) {
|
||||
return new UnmappedRareTerms(name, pipelineAggregators(), metadata);
|
||||
return new UnmappedRareTerms(name, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -94,7 +93,7 @@ public class UnmappedRareTerms extends InternalRareTerms<UnmappedRareTerms, Unma
|
|||
|
||||
@Override
|
||||
public InternalAggregation reduce(List<InternalAggregation> aggregations, ReduceContext reduceContext) {
|
||||
return new UnmappedRareTerms(name, pipelineAggregators(), metadata);
|
||||
return new UnmappedRareTerms(name, metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,12 +33,10 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
abstract class AbstractHDRPercentilesAggregator extends NumericMetricsAggregator.MultiValue {
|
||||
|
@ -56,8 +54,8 @@ abstract class AbstractHDRPercentilesAggregator extends NumericMetricsAggregator
|
|||
|
||||
AbstractHDRPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent,
|
||||
double[] keys, int numberOfSignificantValueDigits, boolean keyed, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.keyed = keyed;
|
||||
this.format = formatter;
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.common.io.stream.StreamOutput;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.search.DocValueFormat;
|
||||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
@ -39,9 +38,8 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
|
|||
final boolean keyed;
|
||||
|
||||
AbstractInternalTDigestPercentiles(String name, double[] keys, TDigestState state, boolean keyed, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
Map<String, Object> metadata) {
|
||||
super(name, pipelineAggregators, metadata);
|
||||
super(name, metadata);
|
||||
this.keys = keys;
|
||||
this.state = state;
|
||||
this.keyed = keyed;
|
||||
|
@ -96,11 +94,11 @@ abstract class AbstractInternalTDigestPercentiles extends InternalNumericMetrics
|
|||
}
|
||||
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,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata);
|
||||
Map<String, Object> metadata);
|
||||
|
||||
@Override
|
||||
public XContentBuilder doXContentBody(XContentBuilder builder, Params params) throws IOException {
|
||||
|
|
|
@ -32,12 +32,10 @@ import org.elasticsearch.search.DocValueFormat;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
abstract class AbstractTDigestPercentilesAggregator extends NumericMetricsAggregator.MultiValue {
|
||||
|
@ -55,8 +53,8 @@ abstract class AbstractTDigestPercentilesAggregator extends NumericMetricsAggreg
|
|||
|
||||
AbstractTDigestPercentilesAggregator(String name, ValuesSource valuesSource, SearchContext context, Aggregator parent,
|
||||
double[] keys, double compression, boolean keyed, DocValueFormat formatter,
|
||||
List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.keyed = keyed;
|
||||
this.formatter = formatter;
|
||||
|
|
|
@ -30,12 +30,10 @@ import org.elasticsearch.search.aggregations.Aggregator;
|
|||
import org.elasticsearch.search.aggregations.InternalAggregation;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollector;
|
||||
import org.elasticsearch.search.aggregations.LeafBucketCollectorBase;
|
||||
import org.elasticsearch.search.aggregations.pipeline.PipelineAggregator;
|
||||
import org.elasticsearch.search.aggregations.support.ValuesSource;
|
||||
import org.elasticsearch.search.internal.SearchContext;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class AvgAggregator extends NumericMetricsAggregator.SingleValue {
|
||||
|
@ -48,8 +46,8 @@ class AvgAggregator extends NumericMetricsAggregator.SingleValue {
|
|||
DocValueFormat format;
|
||||
|
||||
AvgAggregator(String name, ValuesSource.Numeric valuesSource, DocValueFormat formatter, SearchContext context,
|
||||
Aggregator parent, List<PipelineAggregator> pipelineAggregators, Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, pipelineAggregators, metadata);
|
||||
Aggregator parent, Map<String, Object> metadata) throws IOException {
|
||||
super(name, context, parent, metadata);
|
||||
this.valuesSource = valuesSource;
|
||||
this.format = formatter;
|
||||
if (valuesSource != null) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.elasticsearch.index.query.QueryShardContext;
|
|||
import org.elasticsearch.search.aggregations.Aggregator;
|
||||
import org.elasticsearch.search.aggregations.AggregatorFactories;
|
||||
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.Numeric;
|
||||
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 java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Numeric> {
|
||||
|
@ -44,9 +42,8 @@ class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Nu
|
|||
@Override
|
||||
protected Aggregator createUnmapped(SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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
|
||||
|
@ -54,8 +51,7 @@ class AvgAggregatorFactory extends ValuesSourceAggregatorFactory<ValuesSource.Nu
|
|||
SearchContext searchContext,
|
||||
Aggregator parent,
|
||||
boolean collectsFromSingleBucket,
|
||||
List<PipelineAggregator> pipelineAggregators,
|
||||
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
Loading…
Reference in New Issue