# Aggregations - getting all buckets with term aggregations

**URL:** <https://discuss.elastic.co/t/aggregations-getting-all-buckets-with-term-aggregations/119697>\
**Category:** Elasticsearch\
**Created:** [February 13, 2018, 7:26pm UTC](https://discuss.elastic.co/t/aggregations-getting-all-buckets-with-term-aggregations/119697 "2018-02-13T19:26:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mc1392](https://avatars.discourse-cdn.com/v4/letter/m/57b2e6/32.png) [@mc1392](https://discuss.elastic.co/u/mc1392)\
**Post date:** [February 13, 2018, 7:26pm UTC](https://discuss.elastic.co/t/aggregations-getting-all-buckets-with-term-aggregations/119697/1 "2018-02-13T19:26:47Z")

</div>

How can I use aggregations to get all of the buckets in my index?  
Right now I add "size:30" to get all of the buckets.

```
GET /index_name/_search?size=0
{
  "aggs":{
    "aggs_name":{
      "terms":{"field":"Field_Name.keyword", **"size": 30** , 
        "order": {
          "_count": "desc"
        }
      }
        }
      }
}

```

But I will not know how many buckets there will be, so I'd like to send a command to get all buckets by default.

---

<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:** [March 13, 2018, 7:26pm UTC](https://discuss.elastic.co/t/aggregations-getting-all-buckets-with-term-aggregations/119697/2 "2018-03-13T19:26:47Z")

</div>

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