Module org.elasticsearch.server
Class BestBucketsDeferringCollector
java.lang.Object
org.elasticsearch.search.aggregations.BucketCollector
org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
org.elasticsearch.search.aggregations.bucket.BestBucketsDeferringCollector
A specialization of
DeferringBucketCollector that collects all
matches and then is able to replay a given subset of buckets which represent
the survivors from a pruning process performed by the aggregator that owns
this collector.-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
DeferringBucketCollector.WrappedAggregatorNested classes/interfaces inherited from class org.elasticsearch.search.aggregations.BucketCollector
BucketCollector.BucketCollectorWrapper -
Field Summary
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_BUCKET_COLLECTOR, NO_OP_COLLECTOR -
Constructor Summary
ConstructorsConstructorDescriptionBestBucketsDeferringCollector(org.apache.lucene.search.Query topLevelQuery, org.apache.lucene.search.IndexSearcher searcher, boolean isGlobal) Sole constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidPost-collection callback.voidPre collection callback.voidprepareSelectedBuckets(LongArray selectedBuckets) Replay the wrapped collector, but only on a selection of buckets.voidrewriteBuckets(LongUnaryOperator howToRewrite) Merge or prune the selected buckets.org.apache.lucene.search.ScoreModeIndicates what features are required from the scorer.voidsetDeferredCollector(Iterable<BucketCollector> deferredCollectors) Set the deferred collectors.wrap(Aggregator in, BigArrays bigArrays) Wrap the provided aggregator so that it behaves (almost) as if it had been collected directly.Methods inherited from class org.elasticsearch.search.aggregations.BucketCollector
asCollector
-
Constructor Details
-
BestBucketsDeferringCollector
public BestBucketsDeferringCollector(org.apache.lucene.search.Query topLevelQuery, org.apache.lucene.search.IndexSearcher searcher, boolean isGlobal) Sole constructor.- Parameters:
isGlobal- Whether this collector visits all documents (global context)
-
-
Method Details
-
scoreMode
public org.apache.lucene.search.ScoreMode scoreMode()Description copied from class:BucketCollectorIndicates what features are required from the scorer.- Specified by:
scoreModein classBucketCollector
-
setDeferredCollector
Set the deferred collectors.- Specified by:
setDeferredCollectorin classDeferringBucketCollector
-
getLeafCollector
- Specified by:
getLeafCollectorin classBucketCollector- Throws:
IOException
-
preCollection
Description copied from class:BucketCollectorPre collection callback.- Specified by:
preCollectionin classBucketCollector- Throws:
IOException
-
postCollection
Description copied from class:BucketCollectorPost-collection callback.- Specified by:
postCollectionin classBucketCollector- Throws:
IOException
-
prepareSelectedBuckets
Replay the wrapped collector, but only on a selection of buckets.- Specified by:
prepareSelectedBucketsin classDeferringBucketCollector- Throws:
IOException
-
wrap
Wrap the provided aggregator so that it behaves (almost) as if it had been collected directly.- Overrides:
wrapin classDeferringBucketCollector
-
rewriteBuckets
Merge or prune the selected buckets.This process rebuilds some packed structures and is O(number_of_collected_docs) so do your best to skip calling it unless you need it.
- Parameters:
howToRewrite- a unary operator which maps a bucket's ordinal to the ordinal it has after this process. If a bucket's ordinal is mapped to -1 then the bucket is removed entirely.
-