# Aggregation is too slow

**URL:** <https://discuss.elastic.co/t/aggregation-is-too-slow/133424>\
**Category:** Elasticsearch\
**Created:** [May 27, 2018, 1:25pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424 "2018-05-27T13:25:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![cool\_arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cool_arun/32/70465_2.png) [@cool\_arun](https://discuss.elastic.co/u/cool_arun)\
**Post date:** [May 27, 2018, 1:25pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/1 "2018-05-27T13:25:59Z")

</div>

Hi sir,

i'm new to elasticsearch, i have more than 2.5 crores of data in elasticsearch index on a single node cluster, when i perform aggregation query it takes lot of time and even get timeout. i think i'm doing something wrong here, please help me.

ES INFO:  
nodes: 1,  
primary-shards: 30,  
replica-shards: 30,  
total index size: 90gb,  
each shards holding 3gb of data,

SYSTEM INFO:  
250 SSD ram 28GB

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 27, 2018, 4:49pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/2 "2018-05-27T16:49:15Z")

</div>

What type of aggregation are you running?

---

<div class="post-metadata">

**Author:** ![cool\_arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cool_arun/32/70465_2.png) [@cool\_arun](https://discuss.elastic.co/u/cool_arun)\
**Post date:** [May 27, 2018, 5:23pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/3 "2018-05-27T17:23:55Z")

</div>

terms

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 27, 2018, 5:31pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/4 "2018-05-27T17:31:20Z")

</div>

Can you show an example?

---

<div class="post-metadata">

**Author:** ![cool\_arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cool_arun/32/70465_2.png) [@cool\_arun](https://discuss.elastic.co/u/cool_arun)\
**Post date:** [May 27, 2018, 5:33pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/5 "2018-05-27T17:33:05Z")

</div>

MY MODEL QUERY:

FIRST I PERFORM A SIMPLE TEXT SEARCH AND THEN I PERFORM AGGREGATION TO FIND WHICH AUTHOR NAME OCCURUS MOST FREQUENTLY FROM THE RETURNED DOCUMENT

```
        {  
   "query":{  
      "simple_query_string":{  
         "query":"search text"
      }
   },
   "aggs":{  
      "most_frequent_authors":{  
         "terms":{  
            "field":"AuthorList.Name.keyword"
         }
      }
   }
}
```

---

<div class="post-metadata">

**Author:** ![cool\_arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cool_arun/32/70465_2.png) [@cool\_arun](https://discuss.elastic.co/u/cool_arun)\
**Post date:** [May 27, 2018, 5:42pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/6 "2018-05-27T17:42:50Z")

</div>

MY MODEl MAPPING:

```
 {  
           "Abstract":{  
              "type":"text",
              "fields":{  
                 "keyword":{  
                    "type":"keyword",
                    "ignore_above":256
                 }
              }
           },
           "ArticleTitle":{  
              "type":"text",
              "fields":{  
                 "keyword":{  
                    "type":"keyword",
                    "ignore_above":256
                 }
              }
           },
           "AuthorList":{  
              "properties":{  
                        "Name":{  
                          "type":"text",
                          "fields":{  
                             "keyword":{  
                                "type":"keyword",
                                "ignore_above":256
                             }
                    }
                 }
              }
           }
        }
```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [May 27, 2018, 5:52pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/7 "2018-05-27T17:52:16Z")

</div>

Is there anything in the logs, e.g. around long or frequent GC? How large heap do you have configured? How does CPU and disk I/O look like when you are querying?

---

<div class="post-metadata">

**Author:** ![cool\_arun](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cool_arun/32/70465_2.png) [@cool\_arun](https://discuss.elastic.co/u/cool_arun)\
**Post date:** [May 27, 2018, 6:15pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/8 "2018-05-27T18:15:44Z")

</div>

heap size 12gb

---

<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:** [June 24, 2018, 6:15pm UTC](https://discuss.elastic.co/t/aggregation-is-too-slow/133424/9 "2018-06-24T18:15:49Z")

</div>

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