Spaces method and path for this operation:
get /s/{space_id}/api/alerting/rule/{id}/query_inspector
Refer to Spaces for more information.
Returns the Elasticsearch query that a rule executes, and optionally its response.
Query parameters
-
The inspection mode. Use "build" to return only the query, or "execute" to run the query and include the response.
Values are
buildorexecute. Default value isbuild. -
The alert document ID. When provided, the query inspector uses the evaluation time range from the alert instead of the current time.
GET
/api/alerting/rule/{id}/query_inspector
curl \
--request GET 'https://localhost:5601/api/alerting/rule/{id}/query_inspector' \
--header "Authorization: $API_KEY"
Response examples (200)
{
"queries": [
{
"index": "metrics-*",
"request": {
"aggs": {
"groupings": {
"composite": {
"size": 500,
"sources": []
}
}
},
"query": {
"bool": {
"filter": [
{
"range": {
"@timestamp": {
"gte": "2026-01-01T00:00:00.000Z",
"lte": "2026-01-01T00:05:00.000Z"
}
}
}
]
}
},
"size": 0
}
}
]
}