# Allowing size to be max \[possibly inifinity\]

**URL:** <https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594>\
**Category:** Elasticsearch\
**Created:** [April 17, 2024, 9:33am UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594 "2024-04-17T09:33:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)\
**Post date:** [April 17, 2024, 9:33am UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594/1 "2024-04-17T09:33:45Z")

</div>

Hi, I've the below an aggregate query response:  
As you can see "sum\_other\_doc\_count": 399 and only 10 buckets are returned. I would like sum\_other\_doc\_count to be always 0 and return all buckets, irrespective of time it takes to perform the query. Is there any way?

```auto
{
    "took": 18,
    "timed_out": false,
    "_shards": {
        "total": 1,
        "successful": 1,
        "skipped": 0,
        "failed": 0
    },
    "hits": {
        "total": {
            "value": 82,
            "relation": "eq"
        },
        "max_score": null,
        "hits": []
    },
    "aggregations": {
        "aq_agg_test_case": {
            "doc_count": 474,
            "aq_agg_name": {
                "doc_count_error_upper_bound": 0,
                "sum_other_doc_count": 399,
                "buckets": [
                    {
                        "key": "Resource Management - TC-1",
                        "doc_count": 8
                    },
                    {
                        "key": "Resource Management - TC-2",
                        "doc_count": 8
                    },
                    {
                        "key": "Resource Management - TC-3",
                        "doc_count": 8
                    },
                    {
                        "key": "Resource Management - TC-4",
                        "doc_count": 8
                    },
                    {
                        "key": "Resource Management - TC-5",
                        "doc_count": 8
                    },
                    {
                        "key": "Collaboration Features - TC-1",
                        "doc_count": 7
                    },
                    {
                        "key": "Collaboration Features - TC-2",
                        "doc_count": 7
                    },
                    {
                        "key": "Cross-Device Syncing-TC-1",
                        "doc_count": 7
                    },
                    {
                        "key": "Cross-Device Syncing-TC-2",
                        "doc_count": 7
                    },
                    {
                        "key": "Cross-Device Syncing-TC-3",
                        "doc_count": 7
                    }
                ]
            }
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [April 19, 2024, 9:05am UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594/2 "2024-04-19T09:05:30Z")

</div>

Hi,

you can increase the `size` parameter in your aggregation query. However, please note that setting a very high value for the `size` parameter can significantly increase the time it takes to perform the query and the amount of resources used.

Here is an example of how to increase the `size` parameter in your aggregation:

```auto
{
  "aggs": {
    "aq_agg_test_case": {
      "terms": {
        "field": "your_field",
        "size": 10000 // Increase this value to get more buckets
      }
    }
  }
}

```

Regards

---

<div class="post-metadata">

**Author:** ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)\
**Post date:** [April 21, 2024, 5:13am UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594/3 "2024-04-21T05:13:29Z")

</div>

Ok, so one question. Is the max limit of size value to 10,000? Or I can put any value in it?

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [April 21, 2024, 3:07pm UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594/4 "2024-04-21T15:07:20Z")

</div>

Hi,

The maximum limit for the `size` parameter in Elasticsearch terms aggregation is indeed 10,000. This limit is set to prevent memory issues.

---

<div class="post-metadata">

**Author:** ![Vivek\_Burman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_burman/32/118310_2.png) [@Vivek\_Burman](https://discuss.elastic.co/u/Vivek_Burman)\
**Post date:** [April 21, 2024, 3:20pm UTC](https://discuss.elastic.co/t/allowing-size-to-be-max-possibly-inifinity/357594/5 "2024-04-21T15:20:14Z")

</div>

So let's say at some point of time the limit prevents all aggregation results to be retrieved. So is there any way to iterate over the rest of aggregation buckets?

Meaning i can somehow iterate over `sum_other_doc_count` maybe making multiple requests with some pagination?
