# Getting number of indexed documents when there is a replica

**URL:** <https://discuss.elastic.co/t/getting-number-of-indexed-documents-when-there-is-a-replica/359333>\
**Category:** Elasticsearch\
**Created:** [May 13, 2024, 3:07am UTC](https://discuss.elastic.co/t/getting-number-of-indexed-documents-when-there-is-a-replica/359333 "2024-05-13T03:07:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hjazz6](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hjazz6/32/79007_2.png) [@hjazz6](https://discuss.elastic.co/u/hjazz6)\
**Post date:** [May 13, 2024, 3:07am UTC](https://discuss.elastic.co/t/getting-number-of-indexed-documents-when-there-is-a-replica/359333/1 "2024-05-13T03:07:51Z")

</div>

Hi,

I'm trying to calculate the indexing rate of my ES (version 8.8.0), and I've been using the API below to do that when I set `replica = 0`.

`GET <index_name>/_stats/indexing?filter_path=indices.*.total.indexing.index_total`

I would get the difference of the `index_total` values within a time period, and then divide by the time period to get the indexing rate.

When I set `replica = 1`, I get approximately 35-40% higher indexing rate than when no replica was set. Is this because the API included the documents indexed in the replica? If so, how do I get the indexing rate for only the primary shards then?

Thank you.

---

<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:** [May 13, 2024, 7:53am UTC](https://discuss.elastic.co/t/getting-number-of-indexed-documents-when-there-is-a-replica/359333/2 "2024-05-13T07:53:42Z")

</div>

> [@hjazz6](#):
>
> how do I get the indexing rate for only the primary shards then?

`GET <index_name>/_stats/indexing?filter_path=indices.*.primaries.indexing.index_total`
