# Get the filtered response in Elasticsearch cat APIs

**URL:** <https://discuss.elastic.co/t/get-the-filtered-response-in-elasticsearch-cat-apis/264522>\
**Category:** Elasticsearch\
**Created:** [February 17, 2021, 7:36am UTC](https://discuss.elastic.co/t/get-the-filtered-response-in-elasticsearch-cat-apis/264522 "2021-02-17T07:36:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bhavya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/bhavya/32/45679_2.png) [@bhavya](https://discuss.elastic.co/u/bhavya)\
**Post date:** [February 17, 2021, 7:36am UTC](https://discuss.elastic.co/t/get-the-filtered-response-in-elasticsearch-cat-apis/264522/1 "2021-02-17T07:36:05Z")

</div>

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

```auto
  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.

```auto
  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](https://stackoverflow.com/a/57727356/10348758) because I would be implementing the code also and using the Get request in the browser itself.**

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 17, 2021, 7:36am UTC](https://discuss.elastic.co/t/get-the-filtered-response-in-elasticsearch-cat-apis/264522/2 "2021-03-17T07:36:55Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
