Type to search.

PromQL operators

Serverless

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

Availability

  • Generally available

    This functionality is generally available and ready for production usage.

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

Stack GA 9.5+ …

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

Availability

  • Generally available since 9.5

    This functionality is generally available and ready for production usage.

  • Preview in 9.4

    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.

These operators are based on the Prometheus operators. Refer to the Prometheus documentation for the full semantics. Each operator entry lists its differences from Prometheus, including the uses that aren't supported yet.

Binary operators that perform arithmetic between scalars and instant vectors.

Binary operators that filter instant vectors or, with the bool modifier, return 0 or 1.

Binary operators that combine two instant vectors by matching their label sets.

Operators that apply to a single instant vector or scalar.

Operators used inside instant vector selectors ({...}) to match series by label.

PromQL follows the same binary operator precedence as Prometheus. The following list orders operators from highest to lowest precedence; operators listed together share the same precedence level:

  1. ^
  2. *, /, %, atan2
  3. +, -
  4. ==, !=, <=, <, >=, >
  5. and, unless
  6. or

^ is right-associative; all other binary operators are left-associative. Use parentheses to override the default precedence.

Note

This list also includes the operators that are not supported yet in Elasticsearch. Also refer to Prometheus compatibility.

When a binary operator is applied between two instant vectors, PromQL matches samples that have identical label sets (one-to-one matching). Prometheus provides modifiers that change which labels are considered (on(...) and ignoring(...)) and that enable many-to-one and one-to-many matching (group_left and group_right).

For the vector matching modifiers that Elasticsearch supports, refer to Prometheus compatibility.

By default, a comparison operator between two instant vectors acts as a filter: samples that do not satisfy the comparison are dropped, and matching samples keep their original values. Appending the bool modifier changes this behavior so that the comparison returns 0 for false and 1 for true, and keeps every sample. The bool modifier is required when comparing two scalars.

Example

Text
requests_total > bool 256

Prometheus documents aggregation operators (such as sum, avg, min, max, and count) on its operators page. In Elasticsearch PromQL, these are documented as aggregation functions.

The following Prometheus operators are not supported yet in Elasticsearch:

  • </
  • >/
  • and
  • atan2
  • unless