Aggregations reference
Astra supports a variety of search aggregations which fall into three primary categories: metric aggregations, bucket aggregations, and pipeline aggregations.
Metric aggregations
Metric aggregations typically operate on single or multiple value fields and allow you to do simple field calculations, such as finding the average value.
Average
- field (required)
Sets the field to use for this aggregation.
- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Extended stats
- field (required)
Sets the field to use for this aggregation.
- sigma (optional)
Sets the sigma to use for this aggregation.
- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Max
- field (required)
Sets the field to use for this aggregation.
- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Min
- field (required)
Sets the field to use for this aggregation.
- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Percentiles
- field (required)
Sets the field to use for this aggregation.
- percents (optional)
Set the values to compute percentiles from (ie,
[50, 95, 99, 99.9.]
).- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Sum
- field (required)
Sets the field to use for this aggregation.
- script (optional)
Sets the script to use for this aggregation.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Unique count
- field (required)
Sets the field to use for this aggregation.
- precision_threshold (optional)
Set a precision threshold. Higher values improve accuracy but also increase memory usage.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Bucket aggregations
Bucket aggregations categorize the results into common groupings known as buckets. These groupings are based on the field values of individual results, and include date and value based aggregations.
Date histogram
- field (required)
Sets the field to use for this aggregation.
- min_doc_count (required)
Set the minimum count of matching documents that buckets need to have.
- interval (required)
Sets the field to use for this aggregation.
- offset (optional)
Set the offset on this builder, as a time value (1m, 10m).
- time_zone (optional)
Sets the time zone to use for this aggregation.
- extended_bounds (optional)
Set extended bounds on this histogram, so that buckets would also be generated on intervals that did not match any documents.
- min
Minimum epoch in milliseconds
- max
Maximum epoch in milliseconds
- buckets (optional)
Sets the number of buckets to return when using an
auto
interval.- minimum_interval (optional)
Sets the minimum interval expression when using an
auto
interval.
Filters
- filters (required)
List of keyed filters to use for this aggregation.
- {filter key} (required)
- query (required)
Query string to use for this keyed filter.
- analyze_wildcard (required)
Set to
true
to enable analysis on wildcard and prefix queries.
Histogram
- field (required)
Sets the field to use for this aggregation.
- min_doc_count (required)
Set the minimum count of matching documents that buckets need to have.
- interval (required)
Sets the interval to use for this aggregation
Terms
- field (required)
Sets the field to use for this aggregation.
- min_doc_count (required)
Set the minimum document count terms should have in order to appear in the response.
- size (required)
Indicates how many term buckets should be returned (defaults to 10)
- order (required)
Sets the order in which the buckets will be returned.
- missing (optional)
Sets the value to use when the aggregation finds a missing value in a document.
Pipeline aggregations
Pipeline aggregations enable nesting multiple aggregations together, feeding the results of one aggregation as the input to another aggregation.
Cumulative sum
- buckets path (required)
Path to pipeline aggregation.
- format (optional)
Sets the format to use on the output of this aggregation.
Derivative
- buckets path (required)
Path to pipeline aggregation.
- unit (optional)
Sets the unit to use for this aggregation.
Moving average
- buckets path (required)
Path to pipeline aggregation.
- model (required)
Sets a model for the moving average. The model is used to define what type of moving average you want to use on the series, and is one of
simple
,linear
,ewma
,holt
, orholt_winters
.- simple
Calculate a simple unweighted (arithmetic) moving average.
- linear
Calculate a linearly weighted moving average, such that older values are linearly less important. "Time" is determined by position in collection.
- ewma
Calculate a exponentially weighted moving average.
- holt
Calculate a doubly exponential weighted moving average.
- holt_winters
Calculate a triple exponential weighted moving average.
- window (optional)
Sets the window size for the moving average. This window will "slide" across the series, and the values inside that window will be used to calculate the moving avg value.
- predict (optional)
Sets the number of predictions that should be returned. Each prediction will be spaced at the intervals specified in the histogram. E. g "predict: 2" will return two new buckets at the end of the histogram with the predicted values.
Moving function
- buckets path (required)
Path to pipeline aggregation
- window (required)
Window size for this aggregation
- script (required)
Sets the Painless script to use for this aggregation.
- shift (optional)
Sets the window shift to use for this aggregation.