Search.max_buckets limit error on 7.6.0 even after setting to 10000

I am using a simple query with aggregation.
GET testIndex/_search

{
  "size": 0,
  "aggs": {
    "Name1": {
      "terms": {
        "field": "field1.keyword",
        "size": 10000
      }
    },
    "Name2":{
      "terms": {
        "field": "field2.keyword",
        "size": 10000
      }
    }
  }
}

Here for Name2 aggregation bucket actual size is more than 10000. But since I am already limiting its length to 10000 from size parameter can anyone explain why I am still getting this error:

Trying to create too many buckets. Must be less than or equal to: [10000] but was [10001]. This limit can be set by changing the [search.max_buckets] cluster level setting.","max_buckets":10000}},"status":503}

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