Skip to content

max - Calculate the max value

The max function will return the largest value passed into a function. It is most typically used as an aggregation.

Syntax

max(value: number, ...values: number): number

Arguments

Name Type Required Description
value number true The first numerical value to test
...values number true All subsequent numerical values

Example - Capturing largest latency per page

Consider the following documents:

{
    "path": "/home",
    "latency": 320
},
{
    "path": "/checkout",
    "latency": 5000
}

We can capture the largest value for latency using the top command:

top 10 path by max(latency)

This will give the top 10 values for path that have the highest latency.