Elasticsearch: Shard List
 
    Elasticsearch’s cat API is something that you will be using a lot when learning about Elasticsearch and gaining hands on experience with. It allows users to view information related to various Elasticsearch engine resources in Compact and Aligned Text (CAT).
Listing Shards in a Cluster
To view all the shards in an Elasticsearch cluster, you can use the GET request at the _cat/shards API endpoint, as follows:
GET _cat/shardsOutput
.watcher-history-13-2021.03.16                                            0 r STARTED                   10.46.8.56  instance-0000000009
.watcher-history-13-2021.03.16                                            0 p STARTED                   10.46.8.45  instance-0000000008
.ds-logs-iis.error-default-2021.02.26-000034                              0 p STARTED   330534   52.8mb 10.46.8.166 instance-0000000006
.ds-logs-iis.error-default-2021.02.26-000034                              0 r STARTED   330534   52.8mb 10.46.8.45  instance-0000000008
.ds-logs-endpoint.events.registry-default-2021.03.10-000036               0 r STARTED   265419   65.4mb 10.46.8.56  instance-0000000009
.ds-logs-endpoint.events.registry-default-2021.03.10-000036               0 p STARTED   265419   65.4mb 10.46.8.45  instance-0000000008
.reporting-2021-01-10                                                     0 p STARTED        0    3.3kb 10.46.8.166 instance-0000000006
.reporting-2021-01-10                                                     0 r STARTED        0    3.3kb 10.46.8.132 instance-0000000010
.kibana-event-log-7.11.1-000004                                           0 p STARTED   458775   43.3mb 10.46.8.166 instance-0000000006
.kibana-event-log-7.11.1-000004                                           0 r STARTED   458775   43.3mb 10.46.8.132 instance-0000000010
.watcher-history-13-2021.02.19                                            0 p STARTED                   10.46.8.56  instance-0000000009
.watcher-history-13-2021.02.19                                            0 r STARTED                   10.46.8.132 instance-0000000010
.ds-metrics-system.diskio-default-2021.03.14-000018                       0 r STARTED   128927   28.5mb 10.46.8.166 instance-0000000006
.ds-metrics-system.diskio-default-2021.03.14-000018                       0 p STARTED   128927   28.5mb 10.46.8.132 instance-0000000010
.ds-logs-endpoint.events.security-default-2021.03.04-000034               0 r STARTED  5904050  856.5mb 10.46.8.56  instance-0000000009
.ds-logs-endpoint.events.security-default-2021.03.04-000034               0 p STARTED  5904050  856.5mb 10.46.8.45  instance-0000000008
shrink-.ds-logs-elastic_agent-default-2021.03.09-000009                   0 p STARTED    30868    6.1mb 10.46.8.166 instance-0000000006
shrink-.ds-logs-elastic_agent-default-2021.03.09-000009                   0 r STARTED    30868    6.1mb 10.46.8.132 instance-0000000010
.monitoring-kibana-7-2021.03.13                                           0 p STARTED    34520    5.6mb 10.46.8.166 instance-0000000006
.monitoring-kibana-7-2021.03.13                                           0 r STARTED    34520    5.6mb 10.46.8.132 instance-0000000010To view the entire output, you can view here.
YAML
Filter the output and specify the format of the result. So the following will show you how to get the result in YAML format, add the format=yaml parameter to the request, as follows:
GET _cat/shards?format=yamlOutput
---
- index: ".ds-logs-windows.powershell_operational-default-2021.02.19-000017"
  shard: "0"
  prirep: "r"
  state: "STARTED"
  docs: "0"
  store: "208b"
  ip: "10.46.8.56"
  node: "instance-0000000009"
- index: ".ds-logs-windows.powershell_operational-default-2021.02.19-000017"
  shard: "0"
  prirep: "p"
  state: "STARTED"
  docs: "0"
  store: "208b"
  ip: "10.46.8.45"
  node: "instance-0000000008"
- index: "shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015"
  shard: "0"
  prirep: "r"
  state: "STARTED"
  docs: "746234"
  store: "113.8mb"
  ip: "10.46.8.56"
  node: "instance-0000000009"
- index: "shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015"
  shard: "0"
  prirep: "p"
  state: "STARTED"
  docs: "746234"
  store: "113.8mb"
  ip: "10.46.8.132"
  node: "instance-0000000010"
- index: ".ds-metrics-windows.service-default-2021.03.16-000041"
  shard: "0"
  prirep: "p"
  state: "STARTED"
  docs: "720709"
  store: "137mb"
  ip: "10.46.8.166"
  node: "instance-0000000006"To view the entire output, you can view yaml here.
JSON
To obtain specific headers. So to be able to obtain the index name, shard name, shard state, shard disk space, node id, and node IP, filter by passing them to the header as:
GET _cat/shards?h=index,shard,state,store,id,ip&format=jsonOutput
[
  {
    "index" : ".ds-logs-windows.powershell_operational-default-2021.02.19-000017",
    "shard" : "0",
    "state" : "STARTED",
    "store" : "208b",
    "id" : "PZdT2lLtQY2GLNOs5LjDAw",
    "ip" : "10.46.8.56"
  },
  {
    "index" : ".ds-logs-windows.powershell_operational-default-2021.02.19-000017",
    "shard" : "0",
    "state" : "STARTED",
    "store" : "208b",
    "id" : "jrXF53dnTdOq90-1IadNng",
    "ip" : "10.46.8.45"
  },
  {
    "index" : "shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015",
    "shard" : "0",
    "state" : "STARTED",
    "store" : "113.8mb",
    "id" : "PZdT2lLtQY2GLNOs5LjDAw",
    "ip" : "10.46.8.56"
  },
  {
    "index" : "shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015",
    "shard" : "0",
    "state" : "STARTED",
    "store" : "113.8mb",
    "id" : "UHs9WM3HQKSUgfP8NMF7Nw",
    "ip" : "10.46.8.132"
  },
  {
    "index" : ".ds-metrics-windows.service-default-2021.03.16-000041",
    "shard" : "0",
    "state" : "STARTED",
    "store" : "137mb",
    "id" : "zMlMvP6xRMC_lvoHcIFvZg",
    "ip" : "10.46.8.166"
  },To view the entire output, you can view json here.
Shard: Specific Index
T0 get info about a shard for a specific index, pass the name of the index as follows:
GET _cat/shards/shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015Output
shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015 0 r STARTED 746234 113.8mb 10.46.8.56  instance-0000000009
shrink-.ds-logs-elastic_agent.filebeat-default-2021.03.15-000015 0 p STARTED 746234 113.8mb 10.46.8.132 instance-0000000010 
            