@Value.Immutable(copy=false) public interface HistogramAggregation extends BucketAggregation, ValuesSourceAggregation
This aggregation dynamically builds fixed size (a.k.a. interval) buckets over the values. For example, if the documents have a field that holds a price (numeric), we can configure this aggregation to dynamically build buckets with interval 5 (in case of price it may represent $5).
When the aggregation executes, the price field of every document will be evaluated and will be rounded down to its closest bucket - for example, if the price is 32 and the bucket size is 5 then the rounding will yield 30 and thus the document will "fall" into the bucket that is associated with the key 30. To make this more formal, here is the rounding function that is used:
bucket_key = Math.floor((value - offset) / interval) * interval + offset
The interval must be a positive decimal, while the offset must be a decimal in [0, interval) (a decimal greater than or equal to 0 and less than interval)
ADJACENCY_MATRIX_AGGREGATION, AVG_AGGREGATION, CARDINALITY_AGGREGATION, DATE_HISTOGRAM_AGGREGATION, DATE_RANGE_AGGREGATION, EXTENDED_STATS_AGGREGATION, FILTER_AGGREGATION, FILTERS_AGGREGATION, GEO_BOUNDS_AGGREGATION, GEO_CENTROID_AGGREGATION, GEO_DISTANCE_AGGREGATION, GEOHASH_GRID_AGGREGATION, GLOBAL_AGGREGATION, HISTOGRAM_AGGREGATION, IP_RANGE_AGGREGATION, MAX_AGGREGATION, MIN_AGGREGATION, MISSING_AGGREGATION, NESTED_AGGREGATION, PERCENTILE_RANKS_AGGREGATION, PERCENTILES_AGGREGATION, RANGE_AGGREGATION, REVERSE_NESTED_AGGREGATION, SAMPLER_AGGREGATION, SIGNIFICANT_TERMS_AGGREGATION, SIGNIFICANT_TEXT_AGGREGATION, STATS_AGGREGATION, SUM_AGGREGATION, TERMS_AGGREGATION, VALUE_COUNT_AGGREGATION| Modifier and Type | Method and Description |
|---|---|
default void |
accept(AggregationVisitor visitor) |
java.lang.Double |
getInterval() |
java.lang.Double |
getMaxBound() |
java.lang.Double |
getMinBound() |
java.lang.Long |
getMinDocCount()
Returns the minimum number of hits required before returning a term.
|
java.lang.Double |
getOffset() |
default java.util.List<BucketOrder> |
getOrder()
Returns the bucket order.
|
java.lang.Boolean |
isKeyed() |
countNotEmpty, getName, getSubAggregations, isEmptygetField, getFormat, getMissing, getTimeZonejava.lang.Double getInterval()
java.lang.Double getMaxBound()
java.lang.Double getMinBound()
java.lang.Long getMinDocCount()
java.lang.Double getOffset()
@Value.Default default java.util.List<BucketOrder> getOrder()
java.lang.Boolean isKeyed()
default void accept(AggregationVisitor visitor)
accept in interface Aggregation