explain_query
Validate query rewrites, profile component timing, and per-document scoring to identify invalid or slow clauses in Elasticsearch queries.
Instructions
Explain a query three ways: (1) _validate/query?rewrite=true shows how ES rewrites it and why it may be invalid, (2) profile=true gives per-component timing to find the slow clause, (3) if doc_id is given, _explain shows why that document matched or did not, with scoring detail.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"index": "<index>",
"query": "<query>"
},
"name": "explain_query"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | ||
| query | Yes | ||
| doc_id | No | ||
| profile | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |