# "size" parameter doubt

**URL:** <https://discuss.elastic.co/t/size-parameter-doubt/80407>\
**Category:** Elasticsearch\
**Created:** [March 29, 2017, 5:43am UTC](https://discuss.elastic.co/t/size-parameter-doubt/80407 "2017-03-29T05:43:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![prashant.bajpai](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant.bajpai/32/16844_2.png) [@prashant.bajpai](https://discuss.elastic.co/u/prashant.bajpai)\
**Post date:** [March 29, 2017, 5:43am UTC](https://discuss.elastic.co/t/size-parameter-doubt/80407/1 "2017-03-29T05:43:46Z")

</div>

It may be a beginner question, but I have some doubts related to size.  
As per elastic search specs, the maximum value of size can be 10000, I want to validate my understandings below:

Sample Query:

```
GET testindex-2016.04.14/_search
{
  "size": 10000,
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "type": "TEST"
          }
        }
      ]
    }
  }, 
  "aggs": {
    "testAggs": {
      "terms": {
        "field": "type",
        "size": 0
      },
      "aggs": {
        "innerAggs": {
          "max": {
            "field": "Value"
          }
        }
      }
    }
  }
}

```

Response:

```
{
  "took": 6,
  "timed_out": false,
  "_shards": {
    "total": 5,
    "successful": 5,
    "failed": 0
  },
  "hits": {
    "total": 26949,
    "max_score": 0,
    "hits": [
       .....10000 records   
     ]
  },
  "aggregations": {
    "test": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "TEST",
          "doc_count": 26949,
          "innerAggs": {
            "value": 150
          }
        }
      ]
    }
  }
}

```

1 - If size is set to 10000, and we have more than 200000 records in elastic search satisfying the query, So in query result, I will get the no. of hits to 10000, but the "total" : 200000.

2 - How many records will be available for further aggregations - the no. of hits or the "total" value.

3 - If we set "size" : 0, in this case, we get hits = 0, but how many records will be available for aggregations ?

Please clarify my understanding, and put comments in any doubt in question . Thanks.

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [March 29, 2017, 6:00am UTC](https://discuss.elastic.co/t/size-parameter-doubt/80407/2 "2017-03-29T06:00:06Z")

</div>

Aggs are computed on the full result set. Whatever size is set to.

Size=0 is ideal as there are some optimizations underneath.

---

<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:** [April 26, 2017, 6:00am UTC](https://discuss.elastic.co/t/size-parameter-doubt/80407/3 "2017-04-26T06:00:12Z")

</div>

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