# Cat shards API param "local" does not apply

**URL:** https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679
**Category:** Elasticsearch
**Created:** [August 4, 2020, 9:28am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679 "2020-08-04T09:28:28Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![CHU\_XU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chu_xu/32/45946_2.png) [@CHU\_XU](https://discuss.elastic.co/u/CHU_XU)
#### Post date: [August 4, 2020, 9:28am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679/1 "2020-08-04T09:28:28Z")

</div>

Hi there,

I'm using the api `_cat/shards` to monitor my shards' info. Since I may have a large cluster and many shards, I would like to collect the info from each node instead of collecting them by one call.

As described in the doc,

`local`  
(Optional, boolean) If `true` , the request retrieves information from the local node only. Defaults to `false` , which means information is retrieved from the master node.

But when I invoke this api on a data node, whether the param is true or false, it returns shards from all nodes.

Any idea why this param does not apply?

Thanks

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [August 4, 2020, 9:55am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679/2 "2020-08-04T09:55:25Z")

</div>

Hey,

I think here is a small misunderstanding what `local` is referring to. It is **not** referring to the fact that only local shards are returned. It is referring to the fact where the information about all shards is fetched **from**. By specifying `local=true` this information is fetched from the node that you are hitting the request with. If nothing is specified or `false` is picked, this information is fetched from the current master node.

Hope this helps!

---

<div class="post-metadata">

### Author: ![CHU\_XU](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/chu_xu/32/45946_2.png) [@CHU\_XU](https://discuss.elastic.co/u/CHU_XU)
#### Post date: [August 5, 2020, 5:44am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679/3 "2020-08-05T05:44:22Z")

</div>

That makes sense, thanks.

BTW, how's the \_cat/shards performance? If I got a index or cluster with hundreds or thousands shards, will it take long to response and have impact to cluster?

---

<div class="post-metadata">

### Author: ![DavidTurner](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/davidturner/32/22453_2.png) [@DavidTurner](https://discuss.elastic.co/u/DavidTurner)
#### Post date: [August 5, 2020, 7:44am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679/4 "2020-08-05T07:44:25Z")

</div>

I think this API has the same bug as `GET _cat/nodes` in that `?local` does not use only local information, see [https://github.com/elastic/elasticsearch/issues/50088](https://github.com/elastic/elasticsearch/issues/50088). I opened [https://github.com/elastic/elasticsearch/issues/60718](https://github.com/elastic/elasticsearch/issues/60718) to report this. The solution will hopefully be to remove this parameter.

The impact of this API is usually fairly small even with thousands of shards, but you can certainly overwhelm your cluster by sending too many requests like this all at once.

---

<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: [September 2, 2020, 7:44am UTC](https://discuss.elastic.co/t/cat-shards-api-param-local-does-not-apply/243679/5 "2020-09-02T07:44:31Z")

</div>

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