Type to search.

Histogram functions

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 functions operate on histogram metrics.

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. 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 arithmetic average of observations stored in a native histogram.

Return type

instant_vector

Parameters

v (instant_vector)
Instant vector input.

Example

Text
histogram_avg(increase(http_request_duration_seconds[5m]))
Note

Differences from Prometheus

Accepts only native histograms. Classic histogram buckets, such as rate(x_bucket[5m]), return an error, where Prometheus returns no results.

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. 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 count of observations stored in a native histogram.

Return type

instant_vector

Parameters

v (instant_vector)
Instant vector input.

Example

Text
histogram_count(increase(http_request_duration_seconds[5m]))
Note

Differences from Prometheus

Accepts only native histograms. Classic histogram buckets, such as rate(x_bucket[5m]), return an error, where Prometheus returns no results.

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. 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 estimated fraction of observations of a classic or native histogram that fall between the provided lower and upper values.

Return type

instant_vector

Parameters

lower (scalar)
Lower bound of the range.
upper (scalar)
Upper bound of the range.
v (instant_vector)
Instant vector input.

Example

Text
histogram_fraction(0, 0.2, increase(http_request_duration_seconds[1h]))
Note

Differences from Prometheus

The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. 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. 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. An argument computed by topk, bottomk, limitk, limit_ratio, or without(...), such as histogram_quantile(0.9, topk(5, a)), isn't supported yet. Aggregate with by(...) first, such as histogram_quantile(0.9, topk(5, sum by (job, le) (a))).

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. 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 φ-quantile of a classic histogram represented by cumulative le buckets or a native (exponential) histogram.

Return type

instant_vector

Parameters

φ (scalar)
Quantile value (0 ≤ φ ≤ 1).
v (instant_vector)
Instant vector input.

Example

Text
histogram_quantile(0.9, rate(http_request_duration_seconds_bucket[5m]))
Note

Differences from Prometheus

A quantile that isn't a number literal, such as histogram_quantile(scalar(a), b), isn't supported yet. The Elastic Stack includes Elastic's core products such as Elasticsearch, Kibana, Logstash, and Beats. Availability Planned We plan to add this functionality in a future Elastic Stack update. Subject to changes. 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. 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. An argument computed by topk, bottomk, limitk, limit_ratio, or without(...), such as histogram_quantile(0.9, topk(5, a)), isn't supported yet. Aggregate with by(...) first, such as histogram_quantile(0.9, topk(5, sum by (job, le) (a))).

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. 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 sum of observations stored in a native histogram.

Return type

instant_vector

Parameters

v (instant_vector)
Instant vector input.

Example

Text
histogram_sum(increase(http_request_duration_seconds[5m]))
Note

Differences from Prometheus

Accepts only native histograms. Classic histogram buckets, such as rate(x_bucket[5m]), return an error, where Prometheus returns no results.