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

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

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

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

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.