我如何知道我的ElasticSearch中存储了多少数据?

w8f9ii69  于 2023-02-03  发布在  ElasticSearch
关注(0)|答案(1)|浏览(246)

我想知道我的ElasticSearch中存储了多少数据。
我正在研究cluster-stats API。
https://www.elastic.co/guide/en/elasticsearch/reference/7.9/cluster-stats.html“存储”-〉size_in_bytes是否显示存储的数据大小?

whitzsjs

whitzsjs1#

是的,使用Cluster stats API,'store'中的size_in_bytes表示分配给选定节点的所有碎片的总大小(以字节为单位)。
统计信息也可以以适合于在请求中添加human=true的人的格式返回,例如:

http://localhost:9200/_cluster/stats?human=true
"store": {
            "size": "93.7mb",
            "size_in_bytes": 98292482,
            "total_data_set_size": "93.7mb",
            "total_data_set_size_in_bytes": 98292482,
            "reserved": "0b",
            "reserved_in_bytes": 0
        },

您还可以使用cat allocation API来获取每个节点已使用和可用的磁盘空间以及节点碎片(disk.indices)使用的磁盘空间:

http://localhost:9200/_cat/allocation?v

如果您想知道集群中每个索引的存储大小,可以使用cat indexs API:

http://localhost:9200/_cat/indices?v

相关问题