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:
java.io.Closeable,java.lang.AutoCloseable,org.apache.lucene.search.Collector,Releasable
public class BestDocsDeferringCollector extends DeferringBucketCollector implements Releasable
A specialization of
DeferringBucketCollector that collects all
matches and then replays only the top scoring documents to child
aggregations. The method
createTopDocsCollector(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
-
Method Summary
Modifier and Type Method Description voidclose()protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc>createTopDocsCollector(int size)intgetDocCount(long parentBucket)LeafBucketCollectorgetLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)protected longgetPriorityQueueSlotSize()voidpostCollection()Post-collection callback.voidpreCollection()Pre collection callback.voidprepareSelectedBuckets(long... selectedBuckets)org.apache.lucene.search.ScoreModescoreMode()voidsetDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)Set the deferred collectors.Methods inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
replay, wrap
-
Method Details
-
scoreMode
public org.apache.lucene.search.ScoreMode scoreMode()- Specified by:
scoreModein interfaceorg.apache.lucene.search.Collector
-
setDeferredCollector
Set the deferred collectors.- Specified by:
setDeferredCollectorin classDeferringBucketCollector
-
getLeafCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException- Specified by:
getLeafCollectorin interfaceorg.apache.lucene.search.Collector- Specified by:
getLeafCollectorin classBucketCollector- Throws:
java.io.IOException
-
createTopDocsCollector
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector(int size) throws java.io.IOException- Throws:
java.io.IOException
-
getPriorityQueueSlotSize
protected long getPriorityQueueSlotSize() -
preCollection
public void preCollection() throws java.io.IOExceptionDescription copied from class:BucketCollectorPre collection callback.- Specified by:
preCollectionin classBucketCollector- Throws:
java.io.IOException
-
postCollection
public void postCollection() throws java.io.IOExceptionDescription copied from class:BucketCollectorPost-collection callback.- Specified by:
postCollectionin classBucketCollector- Throws:
java.io.IOException
-
prepareSelectedBuckets
public void prepareSelectedBuckets(long... selectedBuckets) throws java.io.IOException- Specified by:
prepareSelectedBucketsin classDeferringBucketCollector- Throws:
java.io.IOException
-
getDocCount
public int getDocCount(long parentBucket) -
close
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceReleasable- Throws:
ElasticsearchException
-