Query Prometheus exemplars

  • POST GET /_prometheus/{index}/api/v1/query_exemplars
  • POST GET /_prometheus/api/v1/query_exemplars
Auth

Get the exemplars of the series selected by a PromQL expression over a time range. The endpoint mirrors the Prometheus /api/v1/query_exemplars endpoint.

GET requests send parameters in the query string. POST requests send the same parameters as an application/x-www-form-urlencoded body. Form-encoded POST requests are accepted only on authenticated TLS connections. If you send the same parameter in both the query string and the form body, the API returns 400 with the standard Elasticsearch error body.

Required privileges

Index
read

Path parameters

index string optional

An index expression that restricts which indices are considered, for example metrics-generic.prometheus-*. If you omit it, the default expression metrics-* is used. Only indices with index.mode: time_series are considered. An alias is accepted and index privileges are checked against that alias name.

Leave it out to use /_prometheus/api/v1/query_exemplars.

Query parameters

query string required

The PromQL expression that selects the series.

start string required

The start of the range, as an RFC 3339 timestamp or Unix time in seconds.

end string required

The end of the range, as an RFC 3339 timestamp or Unix time in seconds.

timeout string · default: 2m

The evaluation timeout, as a number of seconds or a duration such as 30s. It must be positive: 0 is rejected with status code 400. The default and the maximum are the xpack.prometheus.query.timeout cluster setting. A request can only lower that cap. Set the cluster setting to -1 to remove the default and the maximum; a positive timeout is then uncapped. When the timeout elapses, the response is 503 with errorType timeout.

Responses

application/json
status string required

The status of the request: success.

data object[] required

The exemplars, grouped by series.

seriesLabels map string to string required

The labels of the series that the exemplars belong to.

exemplars object[] required
labels map string to string required

The labels of the exemplar, such as trace_id.

value string required

The exemplar value, as a string.

timestamp number required

The exemplar timestamp, in Unix seconds.