# Elastic to provide active primary shards percent metric

**URL:** <https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285>\
**Category:** Elasticsearch\
**Created:** [March 23, 2018, 12:33am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285 "2018-03-23T00:33:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fhalde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fhalde/32/21419_2.png) [@fhalde](https://discuss.elastic.co/u/fhalde)\
**Post date:** [March 23, 2018, 12:33am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285/1 "2018-03-23T00:33:10Z")

</div>

We are trying to show metrics such as yield & harvest.

Yield is basically how much of data is available for searching.

The problem with active\_shards\_percent\_as\_num is that it considers both primary and replica. But let's say there are no replica assigned for a index. Then the active\_shards\_percent\_as\_num is 50%. We can't use this number for denoting the yield since we have all the primaries hence the yield should be 100%

I don't see a way of calculating the percentage purely based on active\_primary\_shard count [how do I know how many primary shards are there in the cluster when things are messy]

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 23, 2018, 12:46am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285/2 "2018-03-23T00:46:41Z")

</div>

`active_shards_percent_as_num` gives you an accurate number of all the data that is searchable. It doesn't consider indices with 0 replicas into account, because as long as the primary shards are available what's the concern?

What's the perceived value in this metric you want to calculate?

---

<div class="post-metadata">

**Author:** ![fhalde](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fhalde/32/21419_2.png) [@fhalde](https://discuss.elastic.co/u/fhalde)\
**Post date:** [March 23, 2018, 12:53am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285/3 "2018-03-23T00:53:13Z")

</div>

Here is the thing

Let's say I have an index foo with 5 primary shards with 1 replica. Now if the replicas are not assigned, the active\_shards\_percent will be 50%. But since all the primaries are there, we basically have all the data hence the yield is 100% [yield = available available / total data]

Now let's say there was one primary missing, then the active\_shard\_percent would be around 90-99%. Even in this case the yield should be 100%. Basically I wouldnt want to consider replicas for calculating the yield

With 0 replica yes we can directly use the active\_shards\_percent value.

active\_primary\_shard\_percentage = available primaries / total primaries

So whenever a cluster is RED, we want to tell our clients how much of data is available. If we display active\_shards\_percent, then when no replicas are assigned, it will show 50% but that's not the case afterall [all the primaries will still provide you all the data you need]

@warkolm

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 23, 2018, 1:01am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285/4 "2018-03-23T01:01:21Z")

</div>

Ok that makes sense.

I can't think of anything off the top of my head, but let me think about it. Someone else might also have an idea.

---

<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:** [April 20, 2018, 1:01am UTC](https://discuss.elastic.co/t/elastic-to-provide-active-primary-shards-percent-metric/125285/5 "2018-04-20T01:01:35Z")

</div>

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