elasticsearch6.8
通过下面的路径可以查询elasticsearch某个索引分片信息
http://xx.xx.xx.xx:9200/索引名称/_search_shards
{
"nodes": {
"Q6i1duFYQLmJFIu812DQjQ": {
"name": "node1",
"ephemeral_id": "Zaxg4gF1QweERCnY63t1fA",
"transport_address": "172.26.0.4:9300",
"attributes": {
"ml.machine_memory": "5312626688",
"ml.max_open_jobs": "20",
"xpack.installed": "true",
"ml.enabled": "true"
}
},
"eGOZucwVSqSlivu7U4M15A": {
"name": "node2",
"ephemeral_id": "s6BOw2weR_CWJqIB9t8nxg",
"transport_address": "172.26.0.3:9302",
"attributes": {
"ml.machine_memory": "5312626688",
"ml.max_open_jobs": "20",
"xpack.installed": "true",
"ml.enabled": "true"
}
}
},
"indices": {
"elk-nginx-20191029": {}
},
"shards": [
[
{
"state": "STARTED",
"primary": true,
"node": "Q6i1duFYQLmJFIu812DQjQ",
"relocating_node": null,
"shard": 0,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "hVy0KVIbSdSC7aitI453_A"
}
},
{
"state": "STARTED",
"primary": false,
"node": "eGOZucwVSqSlivu7U4M15A",
"relocating_node": null,
"shard": 0,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "1LEnZTSMQLmLC8-FXUMW4g"
}
}
],
[
{
"state": "STARTED",
"primary": true,
"node": "eGOZucwVSqSlivu7U4M15A",
"relocating_node": null,
"shard": 1,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "pieh1viPT56eXlkZ7Ki4xg"
}
},
{
"state": "STARTED",
"primary": false,
"node": "Q6i1duFYQLmJFIu812DQjQ",
"relocating_node": null,
"shard": 1,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "0jTTLcL5T0in8_IHDSl4Yw"
}
}
],
[
{
"state": "STARTED",
"primary": true,
"node": "Q6i1duFYQLmJFIu812DQjQ",
"relocating_node": null,
"shard": 2,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "OpQ5KMPQQRKPN3IoGfjaaQ"
}
},
{
"state": "STARTED",
"primary": false,
"node": "eGOZucwVSqSlivu7U4M15A",
"relocating_node": null,
"shard": 2,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "qNkggEgoRsSHsli4pgeoXw"
}
}
],
[
{
"state": "STARTED",
"primary": false,
"node": "Q6i1duFYQLmJFIu812DQjQ",
"relocating_node": null,
"shard": 3,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "ag9IdGs6QrO4489j4eY1Vg"
}
},
{
"state": "STARTED",
"primary": true,
"node": "eGOZucwVSqSlivu7U4M15A",
"relocating_node": null,
"shard": 3,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "wnZSVqEkSgK3AC0Y6dVwfQ"
}
}
],
[
{
"state": "STARTED",
"primary": false,
"node": "eGOZucwVSqSlivu7U4M15A",
"relocating_node": null,
"shard": 4,
"index": "elk-nginx-20191029",
"allocation_id": {
"id": "nCJp71GST96W5kK-JQK6mw"
}
},
{
"state": "STARTED", //分片状态
"primary": true, //是否是主分片
"node": "Q6i1duFYQLmJFIu812DQjQ", //所在elasticsearch节点
"relocating_node": null,
"shard": 4, //分片号
"index": "elk-nginx-20191029", //索引名字
"allocation_id": {
"id": "rjY1Y3S7So-jZMhq6YmJ3w"
}
}
]
]
}
nodes为该索引所在的所有elasticsearch实例,shards为该索引对应分片信息
PS:对应elasticsearch官网地址https://www.elastic.co/guide/en/elasticsearch/reference/6.8/search-shards.html,把6.8切换为自身使用elasticsearch版本即可。