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

1 answer

  • answered 2022-05-07 04:30 Val

    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
          }
        }
      }
    }
    

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum