# Slow aggregations query

**URL:** <https://discuss.elastic.co/t/slow-aggregations-query/95195>\
**Category:** Elasticsearch\
**Created:** [July 31, 2017, 1:32pm UTC](https://discuss.elastic.co/t/slow-aggregations-query/95195 "2017-07-31T13:32:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aburakovskiy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/aburakovskiy/32/20617_2.png) [@aburakovskiy](https://discuss.elastic.co/u/aburakovskiy)\
**Post date:** [July 31, 2017, 1:32pm UTC](https://discuss.elastic.co/t/slow-aggregations-query/95195/1 "2017-07-31T13:32:17Z")

</div>

Hi,  
I have a problem with queries with aggregations on a big index.  
My aggregations are basically facets for students list, so I have high cardinality fields (education, skills, titles etc).  
My environment:

> CPU Count 4  
> System Memory 16Gb  
> EC2 Instance Type m4.xlarge

Count of documents 50M  
Document has several nested objects, here is example  
[https://gist.github.com/aburakovskiy/a5088b87b79130d6be91ee9f981323c3](https://gist.github.com/aburakovskiy/a5088b87b79130d6be91ee9f981323c3)

> "education": [  
> {  
> "school": "Gemological Institute of America",  
> "degree": "Graduate jewller, Metal and Jewelry Arts, A",  
> "startDate": "2001-01-01T00:00:00+0000",  
> "endDate": "2002-01-01T00:00:00+0000"  
> },  
> {  
> "school": "University of Mumbai",  
> "degree": "Bachelors , Business/Commerce, General, A",  
> "startDate": "1998-01-01T00:00:00+0000",  
> "endDate": "2001-01-01T00:00:00+0000"  
> }  
> ]

Here is example of query:  
[https://gist.github.com/aburakovskiy/b6ea9d7170e500ff9b66d6c6dff3dda7](https://gist.github.com/aburakovskiy/b6ea9d7170e500ff9b66d6c6dff3dda7)

And it took over 3s.

I've tried to enable "eager\_global\_ordinals", but it didn't increase performance.

Is it possible to improve queries performance (decrease query time to less then 0.5s)?

---

<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 28, 2017, 1:32pm UTC](https://discuss.elastic.co/t/slow-aggregations-query/95195/2 "2017-08-28T13:32:17Z")

</div>

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