# How to change default value size parameter of the terms aggregation?

**URL:** <https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162>\
**Category:** Elasticsearch\
**Created:** [May 7, 2022, 3:02am UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162 "2022-05-07T03:02:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MNB\_1101](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mnb_1101/32/96811_2.png) [@MNB\_1101](https://discuss.elastic.co/u/MNB_1101)\
**Post date:** [May 7, 2022, 3:02am UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162/1 "2022-05-07T03:02:43Z")

</div>

By default, the terms aggregation returns the top ten terms with the most documents. How to change default value of the size parameter of terms aggregation?

---

<div class="post-metadata">

**Author:** ![DineshNaik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dineshnaik/32/89308_2.png) [@DineshNaik](https://discuss.elastic.co/u/DineshNaik)\
**Post date:** [May 7, 2022, 4:54am UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162/2 "2022-05-07T04:54:31Z")

</div>

Hi @MNB_1101  
You can use the `size` parameter to return more terms, up to the [search.max\_buckets](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-settings.html#search-settings-max-buckets) limit.

If your data contains 100 or 1000 unique terms, you can increase the `size` of the `terms` aggregation to return them all. If you have more unique terms and you need them all, use the [composite aggregation](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-aggregations-bucket-composite-aggregation.html) instead.

Larger values of `size` use more memory to compute and, push the whole aggregation close to the `max_buckets` limit. You’ll know you’ve gone too large if the request fails with a message about `max_buckets` .

For ex.

```nohighlight
{
  "aggs": {
    "products": {
      "terms": {
        "field": "product",
        "size": 100,
        "show_term_doc_count_error": true
      }
    }
  }
}

```

---

<div class="post-metadata">

**Author:** ![MNB\_1101](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mnb_1101/32/96811_2.png) [@MNB\_1101](https://discuss.elastic.co/u/MNB_1101)\
**Post date:** [May 7, 2022, 5:02am UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162/3 "2022-05-07T05:02:20Z")

</div>

Thank you for your answer, but I can't change this value when I use create new rule in Kibana, when I define new rule that rule type "Threshold" is selected, by default size is 10:

```auto
{
"aggregations": {
"eventActionGroup": {
"terms": {
"order": {
"_count": "desc"
},
"size": 10,
....

```

---

<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:** [May 8, 2022, 10:27pm UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162/4 "2022-05-08T22:27:53Z")

</div>

Please don't create multiple topics on the same question - [How can I change the default size of the returned aggregations (10) in kibana “create new rule”? - #3 by MNB\_1101](https://discuss.elastic.co/t/how-can-i-change-the-default-size-of-the-returned-aggregations-10-in-kibana-create-new-rule/303860/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:** [May 8, 2022, 10:27pm UTC](https://discuss.elastic.co/t/how-to-change-default-value-size-parameter-of-the-terms-aggregation/304162/5 "2022-05-08T22:27:56Z")

</div>


