Back to Elasticsearch

PromQL reference [promql-language]

docs/reference/query-languages/promql.md

9.5.02.3 KB
Original Source

PromQL reference [promql-language]

The Prometheus Query Language (PromQL) is a functional query language to select and aggregate metrics.

What is PromQL in {{es}}? [promql-what]

{{es}} supports PromQL queries for metrics in time series data streams (TSDS). PromQL support is not limited to metrics ingested through Prometheus remote write. All TSDS are supported, including metrics ingested through OpenTelemetry Protocol (OTLP), and the bulk API.

{{es}} supports PromQL in two ways: through a Prometheus-compatible HTTP API (for Prometheus-compatible clients) and as a PROMQL source command inside piped {{esql}} queries that allow post-processing through regular {{esql}}.

How does it work? [promql-how]

When you use the Prometheus-compatible HTTP API or embed PromQL in an {{esql}} query through the PROMQL source command, {{es}} parses PromQL into {{esql}} logical plans and evaluates those plans against TSDS metrics.

{{es}} uses the same {{esql}} compute engine for PromQL as for the TS source command.

In this section

  • HTTP API: Prometheus-compatible /_prometheus/ endpoints for queries and discovery.
  • Functions: PromQL function reference organized by category, including {{es}}-specific differences from Prometheus.
  • Operators: PromQL operator reference organized by category, including {{es}}-specific differences from Prometheus.
  • Prometheus data source in Grafana: Use {{es}} as a Prometheus data source in Grafana for dashboards, autocomplete, and Metrics Drilldown.
  • Limitations: How behavior differs from Prometheus, including unsupported PromQL constructs, HTTP behavior, instant-query nuances, staleness semantics, exemplars, and related topics.