# Aggregation - returning all buckets

**URL:** <https://discuss.elastic.co/t/aggregation-returning-all-buckets/20572>\
**Category:** Elasticsearch\
**Created:** [November 5, 2014, 4:19am UTC](https://discuss.elastic.co/t/aggregation-returning-all-buckets/20572 "2014-11-05T04:19:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kilsedar](https://avatars.discourse-cdn.com/v4/letter/k/c2a13f/32.png) [@kilsedar](https://discuss.elastic.co/u/kilsedar)\
**Post date:** [November 5, 2014, 4:19am UTC](https://discuss.elastic.co/t/aggregation-returning-all-buckets/20572/1 "2014-11-05T04:19:42Z")

</div>

Dear all,  
I am running the following query:

curl -XPOST  
"[http://localhost:9200/logstash-2014.11.04/logs/\_search?search\_type=count](http://localhost:9200/logstash-2014.11.04/logs/_search?search_type=count)"  
-d '{  
"aggs": {  
"sessions": {  
"terms": {  
"field": "sessionId",  
"size": 0

```
  },
  "aggs": {
    "sessions_hits": {
      "top_hits": {
        "sort": [
          {
            "@timestamp": {
              "order": "desc"
            }
          }
        ]
      }
    }
  }
}

```

}  
}'

As I read on multiple resources, setting size to 0 should return all  
buckets, however I am still getting 3 buckets per aggregation.

What am I doing wrong here?

Thank you!

Eylül

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/fb54a9a9-405f-43bb-91fc-2f2b90329913%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fb54a9a9-405f-43bb-91fc-2f2b90329913%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:52am UTC](https://discuss.elastic.co/t/aggregation-returning-all-buckets/20572/2 "2017-07-06T00:52:06Z")

</div>


