opensearch_count
Count documents in an OpenSearch index matching a query. Specify optional time range and Lucene query string. Returns only the count, never document content.
Instructions
Fastest way to check how many documents match a condition; never returns content.
Prefer over opensearch_search when you only need the count — it never fills context with document data. Without from_ts/to_ts, scans the full index (4–5 s on 50 M docs).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| index | Yes | Index name or wildcard pattern. | |
| to_ts | No | End time, UTC ISO 8601. | |
| from_ts | No | Start time, UTC ISO 8601. | |
| ts_field | No | Timestamp field name (default "@timestamp"). | @timestamp |
| query_string | No | Lucene query string (default "*" = all documents). | * |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||