This page explains how to use the arg_max aggregation in APL.
arg_max
aggregation in APL helps you identify the row with the maximum value for an expression and return additional fields from that record. Use arg_max
when you want to determine key details associated with a row where the expression evaluates to the maximum value. If you group your data, arg_max
finds the row within each group where a particular expression evaluates to the maximum value.
This aggregation is particularly useful in scenarios like the following:
Splunk SPL users
arg_max
. You can use stats
with a combination of max
and by
clauses to evaluate the maximum value of a single numberic field. APL provides a dedicated arg_max
aggregation that evaluates expressions.ANSI SQL users
arg_max
provides a more concise and efficient alternative.Parameter | Description |
---|---|
expression | The expression whose maximum value determines the selected record. |
field1, field2 | The additional fields to retrieve from the record with the maximum numeric value. |
['sample-http-logs']
dataset.Queryuri | method | req_duration_ms |
---|---|---|
/home | GET | 1200 |
/api/products | POST | 2500 |