Class FiltersAggregator
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.Aggregator
org.elasticsearch.search.aggregations.AggregatorBase
org.elasticsearch.search.aggregations.bucket.BucketsAggregator
org.elasticsearch.search.aggregations.bucket.filter.FiltersAggregator
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.search.Collector,Releasable
- Direct Known Subclasses:
FiltersAggregator.FilterByFilter
public abstract class FiltersAggregator extends BucketsAggregator
Aggregator for
filters. There are two known subclasses,
FiltersAggregator.FilterByFilter which is fast but only works in some cases and
FiltersAggregator.Compatible which works in all cases.
build(java.lang.String, org.elasticsearch.search.aggregations.AggregatorFactories, java.lang.String[], org.apache.lucene.search.Query[], boolean, java.lang.String, org.elasticsearch.search.aggregations.support.AggregationContext, org.elasticsearch.search.aggregations.Aggregator, org.elasticsearch.search.aggregations.CardinalityUpperBound, java.util.Map<java.lang.String, java.lang.Object>) will build the fastest version that
works with the configuration.-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFiltersAggregator.FilterByFilterCollects results by running each filter against the searcher and doesn't build anyLeafBucketCollectors which is generally faster thanFiltersAggregator.Compatiblebut doesn't support when there is a parent aggregator or any child aggregators.static classFiltersAggregator.KeyedFilterNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
BucketsAggregator.BucketBuilderForFixedCount<B>, BucketsAggregator.BucketBuilderForVariable<B>, BucketsAggregator.ResultBuilderForVariable<B>, BucketsAggregator.SingleBucketResultBuilderNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.Aggregator
Aggregator.BucketComparator, Aggregator.Parser, Aggregator.SubAggCollectionMode -
Field Summary
Fields Modifier and Type Field Description static org.elasticsearch.common.ParseFieldFILTERS_FIELDstatic org.elasticsearch.common.ParseFieldOTHER_BUCKET_FIELDstatic org.elasticsearch.common.ParseFieldOTHER_BUCKET_KEY_FIELDprotected java.lang.StringotherBucketKeyFields inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
docCountProviderFields inherited from class org.elasticsearch.search.aggregations.AggregatorBase
collectableSubAggregators, DEFAULT_WEIGHT, name, parent, subAggregatorsFields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR -
Method Summary
Modifier and Type Method Description static FiltersAggregatorbuild(java.lang.String name, AggregatorFactories factories, java.lang.String[] keys, org.apache.lucene.search.Query[] filters, boolean keyed, java.lang.String otherBucketKey, AggregationContext context, Aggregator parent, CardinalityUpperBound cardinality, java.util.Map<java.lang.String,java.lang.Object> metadata)Build anAggregatorfor afiltersaggregation.InternalAggregation[]buildAggregations(long[] owningBucketOrds)Build the results of this aggregation.InternalAggregationbuildEmptyAggregation()Build an empty aggregation.static FiltersAggregator.FilterByFilterbuildFilterOrderOrNull(java.lang.String name, AggregatorFactories factories, java.lang.String[] keys, org.apache.lucene.search.Query[] filters, boolean keyed, java.lang.String otherBucketKey, AggregationContext context, Aggregator parent, CardinalityUpperBound cardinality, java.util.Map<java.lang.String,java.lang.Object> metadata)Build anAggregatorfor afiltersaggregation if we can collectFiltersAggregator.FilterByFilter, otherwise returnnull.protected org.apache.lucene.search.Weight[]buildWeights(org.apache.lucene.search.Query topLevelQuery, org.apache.lucene.search.Query[] filters)Methods inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
bucketComparator, bucketDocCount, buildAggregationsForFixedBucketCount, buildAggregationsForSingleBucket, buildAggregationsForVariableBuckets, buildSubAggsForAllBuckets, buildSubAggsForBuckets, buildSubAggsForBuckets, close, collectBucket, collectExistingBucket, descendsFromGlobalAggregator, getDocCounts, grow, incrementBucketDocCount, maxBucketOrd, preGetSubLeafCollectors, prepareSubAggs, resolveSortPath, rewriteBucketsMethods inherited from class org.elasticsearch.search.aggregations.AggregatorBase
addRequestCircuitBreakerBytes, bigArrays, buildEmptySubAggregations, doClose, doPostCollection, doPreCollection, getLeafCollector, getLeafCollector, metadata, name, parent, pointReaderIfAvailable, postCollection, preCollection, scoreMode, searcher, subAggregator, subAggregators, topLevelQuery, toStringMethods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildTopLevel, collectDebugInfo, resolveSortPathOnValidAggMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
FILTERS_FIELD
public static final org.elasticsearch.common.ParseField FILTERS_FIELD -
OTHER_BUCKET_FIELD
public static final org.elasticsearch.common.ParseField OTHER_BUCKET_FIELD -
OTHER_BUCKET_KEY_FIELD
public static final org.elasticsearch.common.ParseField OTHER_BUCKET_KEY_FIELD -
otherBucketKey
protected final java.lang.String otherBucketKey
-
-
Method Details
-
build
public static FiltersAggregator build(java.lang.String name, AggregatorFactories factories, java.lang.String[] keys, org.apache.lucene.search.Query[] filters, boolean keyed, java.lang.String otherBucketKey, AggregationContext context, Aggregator parent, CardinalityUpperBound cardinality, java.util.Map<java.lang.String,java.lang.Object> metadata) throws java.io.IOExceptionBuild anAggregatorfor afiltersaggregation. If there isn't a parent, there aren't children, and we don't collect "other" buckets then this will a fasterFiltersAggregator.FilterByFilteraggregator. Otherwise it'll fall back to a slower aggregator that isFiltersAggregator.Compatiblewith parent, children, and "other" buckets.- Throws:
java.io.IOException
-
buildFilterOrderOrNull
public static FiltersAggregator.FilterByFilter buildFilterOrderOrNull(java.lang.String name, AggregatorFactories factories, java.lang.String[] keys, org.apache.lucene.search.Query[] filters, boolean keyed, java.lang.String otherBucketKey, AggregationContext context, Aggregator parent, CardinalityUpperBound cardinality, java.util.Map<java.lang.String,java.lang.Object> metadata) throws java.io.IOExceptionBuild anAggregatorfor afiltersaggregation if we can collectFiltersAggregator.FilterByFilter, otherwise returnnull. We can collect filter by filter if there isn't a parent, there aren't children, and we don't collect "other" buckets. CollectingFiltersAggregator.FilterByFilteris generally going to be much faster than theFiltersAggregator.Compatibleaggregator.- Throws:
java.io.IOException
-
buildAggregations
Description copied from class:AggregatorBuild the results of this aggregation.- Specified by:
buildAggregationsin classAggregator- Parameters:
owningBucketOrds- the ordinals of the buckets that we want to collect from this aggregation- Returns:
- the results for each ordinal, in the same order as the array of ordinals
- Throws:
java.io.IOException
-
buildEmptyAggregation
Description copied from class:AggregatorBuild an empty aggregation.- Specified by:
buildEmptyAggregationin classAggregator
-
buildWeights
protected org.apache.lucene.search.Weight[] buildWeights(org.apache.lucene.search.Query topLevelQuery, org.apache.lucene.search.Query[] filters) throws java.io.IOException- Throws:
java.io.IOException
-