A cluster's storage and document counts over time, its request metrics,
and the search terms its users send most. For the current totals only,
read stats on the cluster.
When the store behind these doesn't answer, they return
503 metrics_unavailable, never an empty list, so an empty list always
means there's no data.
On this page: Show a cluster's usage, Show a cluster's request metrics, Show a cluster's top queries.
Show a cluster's usage
GET /v1/clusters/{cluster_id}/usage
- Scope:
clusters:read
One sample per index-stats poll (about every 10 minutes), summed over
the cluster's indices, oldest first. At most 90 days. A cluster that
was never polled has an empty samples, not a zero sample. The
cluster's current totals are stats on the Cluster, not part of this body.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
from | query | string (date-time) | Start of the range, RFC 3339. Defaults to one hour before to. |
to | query | string (date-time) | End of the range, RFC 3339. Defaults to now. |
Example request
Response
200 OK. Usage samples.
| Field | Type | Description |
|---|---|---|
from | string (date-time) | Start of the range. |
to | string (date-time) | End of the range. |
samples | array of objects | Oldest first. Empty when the cluster was never polled in the range. |
samples[].at | string (date-time) | When the sample was taken. |
samples[].bytes | integer | Bytes on disk. |
samples[].docs | integer | Documents. |
samples[].docs_deleted | integer | Deleted documents not yet merged away. |
samples[].shards | integer | Shards, primaries and replicas. |
samples[].primary_shards | integer | Primary shards. |
samples[].health | string | One of green, yellow, red. More may be added. Worst index health. |
Errors
| Status | Codes |
|---|---|
400 | invalid_parameter |
401 | unauthorized |
403 | missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
503 | metrics_unavailable |
Show a cluster's request metrics
GET /v1/clusters/{cluster_id}/metrics
- Scope:
clusters:read
Bucketed request metrics. Without resolution, the server picks the
smallest of 1m, 30m, 1h, 6h, 12h, 1d that gives fewer than 100 buckets
(30 days gives 12h). At most 30 days and 1,000 buckets, and from no
earlier than the start of the UTC day 30 days ago. A range out of
bounds is a 400 naming from, and a resolution not offered or giving
too many buckets is a 400 naming resolution.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
from | query | string (date-time) | Start of the range, RFC 3339. Defaults to one hour before to. |
to | query | string (date-time) | End of the range, RFC 3339. Defaults to now. |
resolution | query | string | Bucket size, one of 1m, 30m, 1h, 6h, 12h, 1d. |
Example request
Response
200 OK. Metric buckets.
| Field | Type | Description |
|---|---|---|
from | string (date-time) | Start of the range. |
to | string (date-time) | End of the range. |
resolution | string | The bucket size asked for, or the one the server picked. |
buckets | array of objects | One per resolution, oldest first. |
buckets[].at | string (date-time) | When the bucket starts. |
buckets[].requests | integer | Requests in the bucket. |
buckets[].writes | integer | Write requests in the bucket. |
buckets[].responses | object | Responses by HTTP status. |
buckets[].responses.status_2xx_3xx | integer | Responses with a 2xx or 3xx status. |
buckets[].responses.status_4xx | integer | Responses with a 4xx status. |
buckets[].responses.status_5xx | integer | Responses with a 5xx status. |
buckets[].duration_ms | object | Percentiles for this bucket. null when there were no requests. |
buckets[].duration_ms.p50 | number or null | Median request duration. |
buckets[].duration_ms.p95 | number or null | 95th percentile request duration. |
buckets[].duration_ms.p99 | number or null | 99th percentile request duration. |
buckets[].duration_histogram | array of objects | Request counts by duration, always 17 buckets in this order. Each starts at its min_ms and ends where the next starts: 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 200, 300, 400, 500, 1000 and 2000 (no upper bound). |
buckets[].duration_histogram[].min_ms | integer | Where the bucket starts, in milliseconds. |
buckets[].duration_histogram[].count | integer | Requests that took that long. |
buckets[].bytes_sent | integer | Bytes the cluster sent to clients. |
buckets[].bytes_received | integer | Bytes the cluster received from clients. |
buckets[].queue_time_ms | number | Time requests waited at Bonsai's load balancer, in milliseconds. Ideally 0. See Dashboard metrics. |
buckets[].concurrency | number | Requests running at the same time. Queue time rises when this reaches the plan's limit. |
Errors
| Status | Codes |
|---|---|
400 | invalid_parameter |
401 | unauthorized |
403 | missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
503 | metrics_unavailable |
Show a cluster's top queries
GET /v1/clusters/{cluster_id}/queries
- Scope:
query_logs:read
The top 100 normalized search strings in a window, with volume and
averages. These are the customer's end users' search terms, so the
token needs query_logs:read.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
cluster_id | path | string | Required. The cluster's ID, which is its slug. It never changes. |
window | query | string | One of 1h, 1d, 7d, 14d, 30d. Defaults to 7d. |
Example request
Response
200 OK. Top queries.
| Field | Type | Description |
|---|---|---|
window | string | The window asked for. |
window_start_at | string (date-time) | When the window starts. |
window_end_at | string (date-time) | When the window ends. |
computed_at | string (date-time) | When the list was computed. |
queries | array of objects | Up to 100 search strings, most frequent first. |
queries[].query | string | Lowercased, quotes stripped. |
queries[].volume | integer | How many times it was searched. |
queries[].avg_duration_ms | number | Average search duration, in milliseconds. |
queries[].avg_hits | number | Average number of hits. |
Errors
| Status | Codes |
|---|---|
400 | invalid_parameter |
401 | unauthorized |
403 | feature_not_enabled, missing_scope |
404 | not_found |
429 | rate_limited, too_many_failed_authentications |
503 | metrics_unavailable |
Ready to power your search with AI?
Launch a fully managed Elasticsearch or OpenSearch cluster, with built-in vector search and AI capabilities.