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 ofDeferringBucketCollector
that 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
Modifier and Type Method Description void
close()
protected org.apache.lucene.search.TopDocsCollector<? extends org.apache.lucene.search.ScoreDoc>
createTopDocsCollector(int size)
int
getDocCount(long parentBucket)
LeafBucketCollector
getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx)
boolean
needsScores()
void
postCollection()
Post-collection callback.void
preCollection()
Pre collection callback.void
prepareSelectedBuckets(long... selectedBuckets)
void
setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.-
Methods inherited from class org.elasticsearch.search.aggregations.bucket.DeferringBucketCollector
replay, wrap
-
-
-
-
Method Detail
-
needsScores
public boolean needsScores()
- Specified by:
needsScores
in interfaceorg.apache.lucene.search.Collector
-
setDeferredCollector
public void setDeferredCollector(java.lang.Iterable<BucketCollector> deferredCollectors)
Set the deferred collectors.- Specified by:
setDeferredCollector
in classDeferringBucketCollector
-
getLeafCollector
public LeafBucketCollector getLeafCollector(org.apache.lucene.index.LeafReaderContext ctx) throws java.io.IOException
- Specified by:
getLeafCollector
in interfaceorg.apache.lucene.search.Collector
- Specified by:
getLeafCollector
in 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
-
preCollection
public void preCollection() throws java.io.IOException
Description copied from class:BucketCollector
Pre collection callback.- Specified by:
preCollection
in classBucketCollector
- Throws:
java.io.IOException
-
postCollection
public void postCollection() throws java.io.IOException
Description copied from class:BucketCollector
Post-collection callback.- Specified by:
postCollection
in classBucketCollector
- Throws:
java.io.IOException
-
prepareSelectedBuckets
public void prepareSelectedBuckets(long... selectedBuckets) throws java.io.IOException
- Specified by:
prepareSelectedBuckets
in classDeferringBucketCollector
- Throws:
java.io.IOException
-
getDocCount
public int getDocCount(long parentBucket)
-
close
public void close() throws ElasticsearchException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceReleasable
- Throws:
ElasticsearchException
-
-