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?

Hi @MNB_1101
You can use the size parameter to return more terms, up to the search.max_buckets limit.

If your data contains 100 or 1000 unique terms, you can increase the size of the terms aggregation to return them all. If you have more unique terms and you need them all, use the composite aggregation instead.

Larger values of size use more memory to compute and, push the whole aggregation close to the max_buckets limit. You’ll know you’ve gone too large if the request fails with a message about max_buckets .

For ex.

  "aggs": {
    "products": {
      "terms": {
        "field": "product",
        "size": 100,
        "show_term_doc_count_error": true

Thank you for your answer, but I can't change this value when I use create new rule in Kibana, when I define new rule that rule type "Threshold" is selected, by default size is 10:

"aggregations": {
"eventActionGroup": {
"terms": {
"order": {
"_count": "desc"
"size": 10,

Please don't create multiple topics on the same question - How can I change the default size of the returned aggregations (10) in kibana “create new rule”? - #3 by MNB_1101