# Getting grouped result collectly

**URL:** <https://discuss.elastic.co/t/getting-grouped-result-collectly/213722>\
**Category:** Elasticsearch\
**Created:** [January 3, 2020, 3:27pm UTC](https://discuss.elastic.co/t/getting-grouped-result-collectly/213722 "2020-01-03T15:27:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuri9163](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuri9163/32/60250_2.png) [@yuri9163](https://discuss.elastic.co/u/yuri9163)\
**Post date:** [January 3, 2020, 3:27pm UTC](https://discuss.elastic.co/t/getting-grouped-result-collectly/213722/1 "2020-01-03T15:27:54Z")

</div>

I have cardinality result 122, but group\_by 0 which supposed to group by same 'global\_fdid'  
returns only 9 result. I'm expecting 122 result. How can I get entire result?

```
  "visit_count" : {
      "cardinality" : {
          "field" : "global_fdid"
      }
  },
 "group_by_0: {
        "terms": {
          "field": "global_fdid"
        },
       "aggs" : {
           "timestamp" : { 
              "max" : { 
              "field" : "start_time" 
             }
        }
 }
```

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [January 3, 2020, 3:32pm UTC](https://discuss.elastic.co/t/getting-grouped-result-collectly/213722/2 "2020-01-03T15:32:36Z")

</div>

Hi Yuri,  
Set the `size` parameter on the `terms` agg to control how many buckets you need back.  
A value in the hundreds is manageable.

---

<div class="post-metadata">

**Author:** ![yuri9163](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yuri9163/32/60250_2.png) [@yuri9163](https://discuss.elastic.co/u/yuri9163)\
**Post date:** [January 3, 2020, 7:42pm UTC](https://discuss.elastic.co/t/getting-grouped-result-collectly/213722/3 "2020-01-03T19:42:33Z")

</div>

Thank you! it worked.

---

<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:** [January 31, 2020, 7:47pm UTC](https://discuss.elastic.co/t/getting-grouped-result-collectly/213722/4 "2020-01-31T19:47:58Z")

</div>

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