# Aggregations.composite\_buckets.composite.size:1000 seems hardcoded for GROUP BY

**URL:** <https://forum.opensearch.org/t/aggregations-composite-buckets-composite-size-1000-seems-hardcoded-for-group-by/10622>\
**Category:** SQL\
**Created:** [August 16, 2022, 10:17am UTC](https://forum.opensearch.org/t/aggregations-composite-buckets-composite-size-1000-seems-hardcoded-for-group-by/10622 "2022-08-16T10:17:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![deathjoin](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/deathjoin/32/3746_2.png) [@deathjoin](https://forum.opensearch.org/u/deathjoin)\
**Post date:** [August 16, 2022, 10:17am UTC](https://forum.opensearch.org/t/aggregations-composite-buckets-composite-size-1000-seems-hardcoded-for-group-by/10622/1 "2022-08-16T10:17:08Z")

</div>

Hi!  
When I run query with aggregation using `GROUP BY` I only get 1000 results because of `aggregations.composite_buckets.composite.size:1000` inserted by parser:

```auto
POST /_plugins/_sql/_explain
{
  "query": """
  SELECT Account, SUM(Credits) FROM someevents-* GROUP BY Account
  """
}

{
  "root": {
    "name": "ProjectOperator",
    "description": {
      "fields": "[Account, SUM(Credits)]"
    },
    "children": [
      {
        "name": "OpenSearchIndexScan",
        "description": {
          "request": """OpenSearchQueryRequest(indexName=someevents-*, sourceBuilder={"from":0,"size":0,"timeout":"1m","aggregations":{"composite_buckets":{"composite":{"size":1000,"sources":[{"Account":{"terms":{"field":"Account","missing_bucket":true,"missing_order":"first","order":"asc"}}}]},"aggregations":{"SUM(Credits)":{"sum":{"field":"Credits"}}}}}}, searchDone=false)"""
        },
        "children": []
      }
    ]
  }
}

```

I want to increase amount of results returned. Is it even possible? Per request to SQL API or by cluster setting.  
I looked at `_cluster/settings` but couldn’t find anything related. `LIMIT 2000` not helping too.

Thanks

---

<div class="post-metadata">

**Author:** ![MaxKsyunz](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.opensearch.org/maxksyunz/32/3690_2.png) [@MaxKsyunz](https://forum.opensearch.org/u/MaxKsyunz)\
**Post date:** [August 18, 2022, 6:54am UTC](https://forum.opensearch.org/t/aggregations-composite-buckets-composite-size-1000-seems-hardcoded-for-group-by/10622/2 "2022-08-18T06:54:41Z")

</div>

Yes, it’s a limitation of the current plugin. Bucket size is hard-coded [here](https://github.com/opensearch-project/sql/blob/8103d9f4f93305f741ba22b7b87dafc4920280f2/opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/aggregation/AggregationQueryBuilder.java#L101).

I believe [this](https://github.com/opensearch-project/sql/issues/703) is the issue to address it.
