Class BestDocsDeferringCollector
- java.lang.Object
-
- org.elasticsearch.search.aggregations.BucketCollector
-
- org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
-
- org.elasticsearch.search.aggregations.bucket.sampler.BestDocsDeferringCollector
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Collector,Releasable
public class BestDocsDeferringCollector extends DeferringBucketCollector implements Releasable
A specialization ofDeferringBucketCollectorthat collects all matches and then replays only the top scoring documents to child aggregations. The methodcreateTopDocsCollector(int)is designed to be overridden and allows subclasses to choose a custom collector implementation for determining the top N matches.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
DeferringBucketCollector.WrappedAggregator
-
-
Field Summary
-
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()protected TopDocsCollector<? extends ScoreDoc>createTopDocsCollector(int size)intgetDocCount(long parentBucket)LeafBucketCollectorgetLeafCollector(LeafReaderContext ctx)Create a newcollectorto collect the given context.protected longgetPriorityQueueSlotSize()voidpostCollection()Post-collection callback.voidpreCollection()Pre collection callback.voidprepareSelectedBuckets(long... selectedBuckets)ScoreModescoreMode()Indicates what features are required from the scorer.voidsetDeferredCollector(Iterable<BucketCollector> deferredCollectors)Set the deferred collectors.-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
replay, wrap
-
-
-
-
Method Detail
-
scoreMode
public ScoreMode scoreMode()
Description copied from interface:CollectorIndicates what features are required from the scorer.
-
setDeferredCollector
public void setDeferredCollector(Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.- Specified by:
setDeferredCollectorin classDeferringBucketCollector
-
getLeafCollector
public LeafBucketCollector getLeafCollector(LeafReaderContext ctx) throws IOException
Description copied from interface:CollectorCreate a newcollectorto collect the given context.- Specified by:
getLeafCollectorin interfaceCollector- Specified by:
getLeafCollectorin classBucketCollector- Parameters:
ctx- next atomic reader context- Throws:
IOException
-
createTopDocsCollector
protected TopDocsCollector<? extends ScoreDoc> createTopDocsCollector(int size) throws IOException
- Throws:
IOException
-
getPriorityQueueSlotSize
protected long getPriorityQueueSlotSize()
-
preCollection
public void preCollection() throws IOExceptionDescription copied from class:BucketCollectorPre collection callback.- Specified by:
preCollectionin classBucketCollector- Throws:
IOException
-
postCollection
public void postCollection() throws IOExceptionDescription copied from class:BucketCollectorPost-collection callback.- Specified by:
postCollectionin classBucketCollector- Throws:
IOException
-
prepareSelectedBuckets
public void prepareSelectedBuckets(long... selectedBuckets) throws IOException- Specified by:
prepareSelectedBucketsin classDeferringBucketCollector- Throws:
IOException
-
getDocCount
public int getDocCount(long parentBucket)
-
close
public void close() throws ElasticsearchException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceReleasable- Throws:
ElasticsearchException
-
-