Size of results on bucket for aggs


(Omar Verduzco) #1

Hi, I'm trying to get a simple aggregation, but looks like the size of the results in the bucket is always limited to 10, I haven't found a way to increase this, I'd like to have all the distinct elements returned. Here's my query, basically built from the documentation: https://www.elastic.co/guide/en/elasticsearch/guide/current/_scoping_aggregations.html

POST users/_search
{
  "size": 0, 
  "aggs": {
    "distinct_users": {
      "terms": {
        "field": "country"
      }
    }
  }
}

(Omar Verduzco) #2

Didn't find any documentation about this, but I got lucky and found the solution, just add "size" under "terms" like this:

POST users/_search
{
"size": 0,
"aggs": {
"distinct_users": {
"terms": {
"size": 20
"field": "country"
}
}
}
}


(system) #3

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