# Speed-up Aggregation Data Histogram Aggregation query for static indices

**URL:** <https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290>\
**Category:** Elasticsearch\
**Created:** [July 16, 2017, 7:42am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290 "2017-07-16T07:42:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ali\_Nazemian](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Ali\_Nazemian](https://discuss.elastic.co/u/Ali_Nazemian)\
**Post date:** [July 16, 2017, 7:42am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290/1 "2017-07-16T07:42:24Z")

</div>

Hi,

I am using Elasticsearch 2.3 in the following scenario:

- Log events are indexed in separate indices hourly. For example, all event related to 16th July 2017 14-15pm indexed in "events\_2017.07.16.14".
- Ingestion rate is about 5000 events per second. So each index contains about 18m documents.
- Each index contains 4 shards and replication 1 (one extra copy)

My situation is I am using Date Histogram Aggregation query for the period of last 30 days frequently. Unfortunately, each query takes about 20 seconds, and it is not acceptable. Generally, for my problem all the indices are read-only, so the result for all the indices except the latest index would be constant. I was wondering how I can change Elasticsearch behaviour to ignore recalculating the Aggregation Query for the static indices? I've tried to enable request caching by changing index settings and change query end date from "now" to "now/d". Unfortunately, it didn't help me and the still query time is not acceptable.

Cheers,  
Ali

---

<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:** [July 16, 2017, 7:48am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290/2 "2017-07-16T07:48:06Z")

</div>

You should upgrade. 5.X has caching for aggregations, but 2.X will recalculate it every time.

---

<div class="post-metadata">

**Author:** ![Ali\_Nazemian](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@Ali\_Nazemian](https://discuss.elastic.co/u/Ali_Nazemian)\
**Post date:** [July 16, 2017, 7:50am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290/3 "2017-07-16T07:50:23Z")

</div>

So there isn't any way I can have an aggregation caching with 2.3?

---

<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:** [July 16, 2017, 7:51am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290/4 "2017-07-16T07:51:49Z")

</div>

Not natively.

---

<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 13, 2017, 7:51am UTC](https://discuss.elastic.co/t/speed-up-aggregation-data-histogram-aggregation-query-for-static-indices/93290/5 "2017-08-13T07:51:55Z")

</div>

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