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

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?

Elasticsearch 7.12.0

Kibana 7.12.0



Solution 1:[1]

That's an easy one to find in the official documentation but you can change the default number of buckets in a terms aggregation using the size parameter:

GET /_search
{
  "aggs": {
    "genres": {
      "terms": { 
        "field": "genre",
        "size": 20                 <--- change this
      }
    }
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Val