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
,org.apache.lucene.search.Collector
,org.elasticsearch.core.Releasable
public class BestDocsDeferringCollector
extends DeferringBucketCollector
implements org.elasticsearch.core.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
Fields inherited from class org.elasticsearch.search.aggregations.BucketCollector
NO_OP_COLLECTOR
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc>
createTopDocsCollector(int size)
int
getDocCount(long parentBucket)
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)
protected long
void
Post-collection callback.void
Pre collection callback.void
prepareSelectedBuckets(long... selectedBuckets)
Replay the deferred hits on the selected buckets.org.apache.lucene.search.ScoreMode
void
setDeferredCollector(Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.Methods inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
wrap
-
Method Details
-
scoreMode
public org.apache.lucene.search.ScoreMode scoreMode()- Specified by:
scoreMode
in interfaceorg.apache.lucene.search.Collector
-
setDeferredCollector
Set the deferred collectors.- Specified by:
setDeferredCollector
in classDeferringBucketCollector
-
getLeafCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws IOException- Specified by:
getLeafCollector
in interfaceorg.apache.lucene.search.Collector
- Specified by:
getLeafCollector
in classBucketCollector
- Throws:
IOException
-
createTopDocsCollector
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc> createTopDocsCollector(int size) throws IOException- Throws:
IOException
-
getPriorityQueueSlotSize
protected long getPriorityQueueSlotSize() -
preCollection
Description copied from class:BucketCollector
Pre collection callback.- Specified by:
preCollection
in classBucketCollector
- Throws:
IOException
-
postCollection
Description copied from class:BucketCollector
Post-collection callback.- Specified by:
postCollection
in classBucketCollector
- Throws:
IOException
-
prepareSelectedBuckets
Description copied from class:DeferringBucketCollector
Replay the deferred hits on the selected buckets.- Specified by:
prepareSelectedBuckets
in classDeferringBucketCollector
- Throws:
IOException
-
getDocCount
public int getDocCount(long parentBucket) -
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceorg.elasticsearch.core.Releasable
- Throws:
ElasticsearchException
-