43 lines
917 B
Plaintext
43 lines
917 B
Plaintext
[discrete]
|
|
[[esql-agg-max]]
|
|
=== `MAX`
|
|
|
|
*Syntax*
|
|
|
|
[source,esql]
|
|
----
|
|
MAX(expression)
|
|
----
|
|
|
|
*Parameters*
|
|
|
|
`expression`::
|
|
Expression from which to return the maximum value.
|
|
|
|
*Description*
|
|
|
|
Returns the maximum value of a numeric expression.
|
|
|
|
*Example*
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/stats.csv-spec[tag=max]
|
|
----
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
|
|===
|
|
include::{esql-specs}/stats.csv-spec[tag=max-result]
|
|
|===
|
|
|
|
The expression can use inline functions. For example, to calculate the maximum
|
|
over an average of a multivalued column, use `MV_AVG` to first average the
|
|
multiple values per row, and use the result with the `MAX` function:
|
|
|
|
[source.merge.styled,esql]
|
|
----
|
|
include::{esql-specs}/stats.csv-spec[tag=docsStatsMaxNestedExpression]
|
|
----
|
|
[%header.monospaced.styled,format=dsv,separator=|]
|
|
|===
|
|
include::{esql-specs}/stats.csv-spec[tag=docsStatsMaxNestedExpression-result]
|
|
|=== |