All Implemented Interfaces:
, , org.apache.lucene.search.Collector, org.elasticsearch.core.Releasable

public abstract class RangeAggregator extends BucketsAggregator
Aggregator for range. There are two known subclasses, RangeAggregator.NoOverlap which is fast but only compatible with ranges that don't have overlaps and RangeAggregator.Overlap which handles overlapping ranges. There is also RangeAggregator.FromFilters which isn't a subclass but is also a functional aggregator for range. build(java.lang.String, org.elasticsearch.search.aggregations.AggregatorFactories, org.elasticsearch.search.aggregations.support.ValuesSourceConfig, org.elasticsearch.search.aggregations.bucket.range.InternalRange.Factory<?, ?>, org.elasticsearch.search.aggregations.bucket.range.RangeAggregator.Range[], boolean, org.elasticsearch.search.aggregations.support.AggregationContext, org.elasticsearch.search.aggregations.Aggregator, org.elasticsearch.search.aggregations.CardinalityUpperBound, java.util.Map<java.lang.String, java.lang.Object>) will build the fastest of the three that is compatible with the requested configuration.
  • Field Details

    • DOCS_PER_RANGE_TO_USE_FILTERS

      public static final double DOCS_PER_RANGE_TO_USE_FILTERS
      Minimum number of docs in the index per range before we attempt to use a filter-based collection mechanism. This exists mostly to keep fast range aggregations fast. Each filter has an overhead in the ball park of half a millisecond just to build its ScorerSupplier. If there are only a couple of thousand docs in the range then it tends not to be worth it to kick in the optimization.

      The value of this field was experimentally derived but the experiment wasn't particularly rigorous. We had a performance test that collected 123 buckets with an average of 900 documents per bucket that jumped from 35ms to 90ms. I figure that 5000 is fairly close to where the break even point is.

      See Also:
      Constant Field Values
    • MAX_ACCURATE_BOUND

      public static final long MAX_ACCURATE_BOUND
      The maximum long that can accurately fit into the double precision floating point bounds.
      See Also:
      Constant Field Values
    • RANGES_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField RANGES_FIELD
    • KEYED_FIELD

      public static final org.elasticsearch.common.xcontent.ParseField KEYED_FIELD
    • valuesSource

      protected final ValuesSource valuesSource
    • ranges

      protected final RangeAggregator.Range[] ranges
  • Constructor Details

  • Method Details