# Elasticsearch aggregation performance

**URL:** <https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044>\
**Category:** Elasticsearch\
**Created:** [July 6, 2020, 5:56pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044 "2020-07-06T17:56:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lschmid](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lschmid](https://discuss.elastic.co/u/lschmid)\
**Post date:** [July 6, 2020, 5:56pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044/1 "2020-07-06T17:56:45Z")

</div>

Hi,

I am trying to test aggregation performance across different ES topologies. The first time running it takes about 26 seconds, and all subsequent runs takes less than a second. I would like to compare performance for the first case.  
I know there is a cache, and I run '\_cache/clear' on all indices between runs. This has no effect. Is there another cache which is storing results causing the enhanced performance? Is there a way to clear this cache to compare the initial performance times?

Thanks

---

<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:** [July 6, 2020, 11:28pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044/2 "2020-07-06T23:28:28Z")

</div>

You probably want this:  
[https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html#\_enabling\_and\_disabling\_caching\_per\_request](https://www.elastic.co/guide/en/elasticsearch/reference/current/shard-request-cache.html#_enabling_and_disabling_caching_per_request)

I use that to turn off the cache when I'm testing stuff. Keep in mind that it isn't really "fair" because you'll have it on in production. And it is possible to design your requests for higher cache hit rate. But disabling it is a useful test sometimes.

---

<div class="post-metadata">

**Author:** ![lschmid](https://avatars.discourse-cdn.com/v4/letter/l/5e9695/32.png) [@lschmid](https://discuss.elastic.co/u/lschmid)\
**Post date:** [July 7, 2020, 5:17pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044/3 "2020-07-07T17:17:33Z")

</div>

I am still seeing the enhanced searching time even with '?request\_cache=false'. Is there different behavior when searching using a wildcard? Ex: GET /my\_indices\_\*/\_search?request\_cache=false

EDIT: Actually, this seems to work to not let entries in the cache in the first place. Seems that "\_cache/clear" is not actually clearly the cache then.

---

<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:** [August 4, 2020, 5:17pm UTC](https://discuss.elastic.co/t/elasticsearch-aggregation-performance/240044/4 "2020-08-04T17:17:33Z")

</div>

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