主页

elasticsearch 查看索引的数据大小

2025-01-22 09:51AM

1. 使用 _cat/indices API

你可以使用 _cat/indices API 来查看特定索引的大小。对于你的索引 social_data,可以执行以下命令:

curl -X GET "http://localhost:9200/_cat/indices/social_data?v"

2. 使用 _stats API

如果你想要更详细的信息,包括文档数量和存储大小,可以使用 _stats API:

curl -X GET "http://localhost:9200/social_data/_stats"

在返回的 JSON 中,查找 total 字段,特别是 store 部分,例如:

"store": {
  "size_in_bytes": 123456789,
  "size": "117.7mb"
}

3. 示例输出

使用 _cat/indices 的输出可能类似于:

health status index       uuid                   pri rep docs.count docs.deleted store.size pri.store.size
yellow open   social_data abcdefghijklmnopqrst   1   1    143163962            0   117.7mb         117.7mb

store.size 列中可以看到索引的大小。

返回>>

登录

请登录后再发表评论。

评论列表:

目前还没有人发表评论