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 class
FiltersAggregator.FilterByFilter
Collects results by running each filter against the searcher and doesn't build anyLeafBucketCollector
s which is generally faster thanFiltersAggregator.Compatible
but doesn't support when there is a parent aggregator or any child aggregators.static class
FiltersAggregator.KeyedFilter
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
BucketsAggregator.BucketBuilderForFixedCount<B>, BucketsAggregator.BucketBuilderForVariable<B>, BucketsAggregator.ResultBuilderForVariable<B>, BucketsAggregator.SingleBucketResultBuilder
Nested 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.ParseField
FILTERS_FIELD
static org.elasticsearch.common.ParseField
OTHER_BUCKET_FIELD
static org.elasticsearch.common.ParseField
OTHER_BUCKET_KEY_FIELD
protected java.lang.String
otherBucketKey
Fields inherited from class org.elasticsearch.search.aggregations.bucket.BucketsAggregator
docCountProvider
Fields inherited from class org.elasticsearch.search.aggregations.AggregatorBase
collectableSubAggregators, DEFAULT_WEIGHT, name, parent, subAggregators
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
Method Summary
Modifier and Type Method Description 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)
Build anAggregator
for afilters
aggregation.InternalAggregation[]
buildAggregations(long[] owningBucketOrds)
Build the results of this aggregation.InternalAggregation
buildEmptyAggregation()
Build an empty aggregation.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)
Build anAggregator
for afilters
aggregation 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, rewriteBuckets
Methods 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, toString
Methods inherited from class org.elasticsearch.search.aggregations.Aggregator
buildTopLevel, collectDebugInfo, resolveSortPathOnValidAgg
Methods 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 anAggregator
for afilters
aggregation. If there isn't a parent, there aren't children, and we don't collect "other" buckets then this will a fasterFiltersAggregator.FilterByFilter
aggregator. Otherwise it'll fall back to a slower aggregator that isFiltersAggregator.Compatible
with 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 anAggregator
for afilters
aggregation 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.FilterByFilter
is generally going to be much faster than theFiltersAggregator.Compatible
aggregator.- Throws:
java.io.IOException
-
buildAggregations
Description copied from class:Aggregator
Build the results of this aggregation.- Specified by:
buildAggregations
in 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:Aggregator
Build an empty aggregation.- Specified by:
buildEmptyAggregation
in 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
-