Class ProfilingLeafBucketCollector

java.lang.Object
org.elasticsearch.search.aggregations.LeafBucketCollector
org.elasticsearch.search.profile.aggregation.ProfilingLeafBucketCollector
All Implemented Interfaces:
org.apache.lucene.search.LeafCollector

public class ProfilingLeafBucketCollector
extends LeafBucketCollector
  • Field Summary

    Fields inherited from class org.elasticsearch.search.aggregations.LeafBucketCollector

    NO_OP_COLLECTOR
  • Constructor Summary

    Constructors
    Constructor Description
    ProfilingLeafBucketCollector​(LeafBucketCollector delegate, AggregationProfileBreakdown profileBreakdown)  
  • Method Summary

    Modifier and Type Method Description
    void collect​(int doc, long bucket)
    Collect the given doc in the bucket owned by owningBucketOrd.
    boolean isNoop()
    Does this collector collect anything? If this returns true we can safely just never call LeafBucketCollector.collect(int, long).
    void setScorer​(org.apache.lucene.search.Scorable scorer)  

    Methods inherited from class org.elasticsearch.search.aggregations.LeafBucketCollector

    collect, wrap

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.lucene.search.LeafCollector

    competitiveIterator
  • Constructor Details

  • Method Details

    • collect

      public void collect​(int doc, long bucket) throws java.io.IOException
      Description copied from class: LeafBucketCollector
      Collect the given doc in the bucket owned by owningBucketOrd.

      The implementation of this method metric aggregations is generally something along the lines of

      
       array[owningBucketOrd] += loadValueFromDoc(doc)
       

      Bucket aggregations have more trouble because their job is to make new ordinals. So their implementation generally looks kind of like

      
       long myBucketOrd = mapOwningBucketAndValueToMyOrd(owningBucketOrd, loadValueFromDoc(doc));
       collectBucket(doc, myBucketOrd);
       

      Some bucket aggregations "know" how many ordinals each owning ordinal needs so they can map "densely". The range aggregation, for example, can perform this mapping with something like:

      
       return rangeCount * owningBucketOrd + matchingRange(value);
       
      Other aggregations don't know how many buckets will fall into any particular owning bucket. The terms aggregation, for example, uses LongKeyedBucketOrds which amounts to a hash lookup.
      Specified by:
      collect in class LeafBucketCollector
      Throws:
      java.io.IOException
    • setScorer

      public void setScorer​(org.apache.lucene.search.Scorable scorer) throws java.io.IOException
      Specified by:
      setScorer in interface org.apache.lucene.search.LeafCollector
      Overrides:
      setScorer in class LeafBucketCollector
      Throws:
      java.io.IOException
    • isNoop

      public boolean isNoop()
      Description copied from class: LeafBucketCollector
      Does this collector collect anything? If this returns true we can safely just never call LeafBucketCollector.collect(int, long).
      Overrides:
      isNoop in class LeafBucketCollector