I am planning to get the information of all the primary shards in my ES cluster using _cat/shards API, but I don't see any option to get only the primary shards in the API response, I tried using prirep:p
in the h=index,store,prirep:p,index&v
but it didn't work also filter_path filter_path=prirep:p
, is there is any way to filter the response in cat APIs of ES.
A sample response from ES
791261 STARTED 563.3mb p my_index
789324 STARTED 563.2mb p my_index
791140 STARTED 563.1mb p my_index
789066 STARTED 562.8mb p my_index
789896 STARTED 562.7mb p my_index
791138 STARTED 562.2mb r my_index
789993 STARTED 562.2mb r my_index
What I want is the below response, notice r
(replica) shards are removed in response.
791261 STARTED 563.3mb p my_index
789324 STARTED 563.2mb p my_index
791140 STARTED 563.1mb p my_index
789066 STARTED 562.8mb p my_index
789896 STARTED 562.7mb p my_index
I don't want to parse the response using jq, as shown in this SO answer because I would be implementing the code also and using the Get request in the browser itself.