| 接口 | GET /<index>/_count 或 POST,请求体只放 query |
|---|---|
| 返回 | count 与 _shards 信息 |
| 绕过参数 | _count 不支持 from/size 与聚合 |
示例
示例
GET /my-index/_count
{
"query": { "term": { "status": "open" } }
}
GET /logs/_count?q=status:error执行 delete_by_query 或 reindex 前先用 _count 核对数量,是避免误操作的常规习惯。