使用GET _cat/shards/<index-name>?v
即可。
示例
数据准备
# 创建索引
PUT student
{
"mappings" : {
"properties" : {
"uid": {
"type" : "integer"
},
"name" : {
"type" : "keyword"
},
"age" : {
"type" : "integer"
}
}
},
"settings" : {
"index" : {
"number_of_shards" : 10,
"number_of_replicas" : 1
}
}
}
# 插入数据
POST student/_doc/1?routing=1
{
"uid": 1,
"name": "张三",
"age": 10
}
# 插入数据
POST student/_doc/2?routing=2
{
"uid": 2,
"name": "张三",
"age": 10
}
查询每个 shard 的统计信息
请求:
GET _cat/shards/student?v
响应:
index shard prirep state docs store ip node
student 2 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 2 r UNASSIGNED
student 4 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 4 r UNASSIGNED
student 8 p STARTED 1 4.1kb 127.0.0.1 DESKTOP-xxxxxx
student 8 r UNASSIGNED
student 7 p STARTED 1 4.1kb 127.0.0.1 DESKTOP-xxxxxx
student 7 r UNASSIGNED
student 6 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 6 r UNASSIGNED
student 3 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 3 r UNASSIGNED
student 5 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 5 r UNASSIGNED
student 9 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 9 r UNASSIGNED
student 1 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 1 r UNASSIGNED
student 0 p STARTED 0 208b 127.0.0.1 DESKTOP-xxxxxx
student 0 r UNASSIGNED