ES|QL aggregation functions
The STATS and INLINE STATS commands support these aggregate functions:
ABSENTReturns true if the input expression yields no non-null values.
AVGReturns the average of a numeric field.
COUNTReturns the total number of input values.
COUNT_DISTINCTReturns the approximate number of distinct values.
EARLIESTReturns the earliest value of a field sorted by timestamp.
FIRSTReturns the earliest occurrence of a field based on a sort field.
LASTReturns the latest occurrence of a field based on a sort field.
LATESTReturns the latest value of a field sorted by timestamp.
MAXReturns the maximum value of a field.
MEDIANReturns the median value of a numeric field.
MEDIAN_ABSOLUTE_DEVIATIONReturns the median absolute deviation, a robust measure of variability.
MINReturns the minimum value of a field.
PERCENTILEReturns the value at which a certain percentage of observed values occur.
PRESENTReturns true if the input expression yields any non-null values.
SAMPLECollects sample values for a field.
SPARKLINEComputes y-axis values of a sparkline graph for an aggregation over time.
ST_CENTROID_AGGCalculates the spatial centroid over a field with geometry type.
ST_EXTENT_AGGCalculates the spatial extent bounding box over a field with geometry type.
STD_DEVReturns the population standard deviation of a numeric field.
SUMReturns the sum of a numeric expression.
TOPCollects the top values for a field, including repeated values.
VALUESReturns unique deduplicated values as a multivalued field.
VARIANCEReturns the population variance of a numeric field.
WEIGHTED_AVGReturns the weighted average of a numeric expression.