Cat shards API param "local" does not apply

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,

(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?



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!

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?

I think this API has the same bug as GET _cat/nodes in that ?local does not use only local information, see I opened 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.

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