Type to search.

Arithmetic 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 binary operators perform arithmetic between scalars and instant vectors. For vector–vector operations, the metric name is dropped from the result.

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.

Adds the two operands element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
requests_total + requests_errors
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.

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.

Divides the left operand by the right operand element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
requests_errors / requests_total
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.

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.

Returns the remainder of dividing the left operand by the right operand element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
metric % 10
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.

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.

Multiplies the two operands element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
100 * rate(requests_total[5m])
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.

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.

Raises the left operand to the power of the right operand element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
metric ^ 2
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.

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.

Subtracts the right operand from the left operand element-wise. For vector–vector operations, the metric name is dropped.

Operands

lhs, rhs (instant_vector or scalar)
The left and right operands. When one side is a scalar, the operator applies between the scalar and each sample of the vector.

Returns

An instant_vector, or a scalar when both operands are scalars.

Example

Text
requests_total - requests_errors
Note

Differences from Prometheus

Native histogram operands, such as h * 2, and some pairs of instant vectors, listed in Prometheus compatibility, aren't supported yet.