Type to search.

ES|QL CLAMP_MAX function

Serverless Preview

Elastic Cloud Serverless projects are autoscaled environments, fully managed by Elastic and available on Elastic Cloud.

Availability

  • Preview

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Serverless interfaces and procedures might differ from classic Elastic Stack deployments.

Stack Preview 9.3+

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats.

Availability

  • Preview since 9.3

    This functionality is in technical preview and is ready for evaluation. Use with caution in production; it is not recommended for mission-critical workloads. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features. Specific Support terms apply.

Unless stated otherwise on the page, this functionality is available when your Elastic Stack is deployed on Elastic Cloud Hosted, Elastic Cloud Enterprise, Elastic Cloud on Kubernetes, and self-managed environments.

This documentation corresponds to the latest patch available for each minor version. If you're not using the latest patch, check the release notes for changes.

Clamps input values to an upper bound, reducing any value above max to max.

Embedded
Embedded
field
field to clamp.
max

The max value to clamp data into.

Limits (or clamps) all input sample values to an upper bound of max. Any value above max is reduced to max.

field max result
boolean boolean boolean
date date date
double double double
double integer double
double long double
double unsigned_long double
integer double double
integer integer integer
integer long long
integer unsigned_long unsigned_long
ip ip ip
keyword keyword keyword
long double double
long integer long
long long long
long unsigned_long unsigned_long
unsigned_long double double
unsigned_long integer unsigned_long
unsigned_long long long
unsigned_long unsigned_long unsigned_long
version version version
ES|QL
TS k8s
| STATS full_clamped_cost=sum(clamp(network.cost, 1, 2)), clamped_cost=sum(clamp_max(network.cost, 1)), clamped_min_cost=sum(clamp_min(network.cost, 10)) BY time_bucket = bucket(@timestamp,1minute)
full_clamped_cost:double clamped_cost:double clamped_min_cost:double time_bucket:datetime
18.0 9.0 94.875 2024-05-10T00:09:00.000Z
15.25 8.0 84.125 2024-05-10T00:08:00.000Z
15.0 8.0 83.5 2024-05-10T00:15:00.000Z
13.75 7.0 71.625 2024-05-10T00:22:00.000Z
13.125 7.5 90.5 2024-05-10T00:18:00.000Z