# Does the replica shard can help to speed up aggregation also?

**URL:** <https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449>\
**Category:** Elasticsearch\
**Created:** [February 23, 2016, 2:33am UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449 "2016-02-23T02:33:32Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kramer\_Li](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kramer_li/32/46872_2.png) [@Kramer\_Li](https://discuss.elastic.co/u/Kramer_Li)\
**Post date:** [February 23, 2016, 2:33am UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/1 "2016-02-23T02:33:32Z")

</div>

Hi

Hi

I know Replica Shard can help to improve search. speed. But how about aggregation? Aggregation is based on field data or Doc Value. So I`m not sure if the replica shard (which is inverted index) will help aggregation also?

Regards  
Mingwei

---

<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:** [February 23, 2016, 6:54pm UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/2 "2016-02-23T18:54:35Z")

</div>

Yes they do!  
Although adding in a lot of replicas can slow things down, so don't go crazy.

---

<div class="post-metadata">

**Author:** ![Kramer\_Li](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kramer_li/32/46872_2.png) [@Kramer\_Li](https://discuss.elastic.co/u/Kramer_Li)\
**Post date:** [February 24, 2016, 2:07am UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/3 "2016-02-24T02:07:46Z")

</div>

Hi

Thanks very much. But can you give some details like how replica can help AGG? Or if there is any doc talking about this?

Regards  
Mingwei

---

<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:** [February 24, 2016, 6:34pm UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/4 "2016-02-24T18:34:25Z")

</div>

Adding a replica means that you have the data in (at least) two places, so it adds the ability to spread the load of the query over more nodes.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [February 25, 2016, 3:52pm UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/5 "2016-02-25T15:52:44Z")

</div>

> [@warkolm](#):
>
> Adding a replica means that you have the data in (at least) two places, so it adds the ability to spread the load of the query over more nodes.

It'll really only speed up the aggregation if you are doing two or more at the same time. If you are just doing one then it is just executed on a single replica.

There are some cases where you can make performance worse with replicas - mostly around disk cache hits. If you have zillions of replicas then each node will have a copy of data and it'll randomly be picked to aggregate on it. So it'll have to load it from the disk. If you have fewer replicas it is more likely that that data will already by in the disk cache. Sometimes. Sometimes having more replicas just lets you bring more CPUs to bear on concurrent requests. So..... its complicated?

Replicas are always good for redundancy.

---

<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:** [July 5, 2017, 11:13pm UTC](https://discuss.elastic.co/t/does-the-replica-shard-can-help-to-speed-up-aggregation-also/42449/6 "2017-07-05T23:13:41Z")

</div>


