# Is hits.total limited by max\_results\_window?

**URL:** <https://discuss.elastic.co/t/is-hits-total-limited-by-max-results-window/61647>\
**Category:** Elasticsearch\
**Created:** [September 27, 2016, 9:58pm UTC](https://discuss.elastic.co/t/is-hits-total-limited-by-max-results-window/61647 "2016-09-27T21:58:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blimpse](https://avatars.discourse-cdn.com/v4/letter/b/5e9695/32.png) [@blimpse](https://discuss.elastic.co/u/blimpse)\
**Post date:** [September 27, 2016, 9:58pm UTC](https://discuss.elastic.co/t/is-hits-total-limited-by-max-results-window/61647/1 "2016-09-27T21:58:58Z")

</div>

Does the `hits.total` field returned for a query reflect the true total number of hits from the entire index, or is it restricted to `max_result_window` for the index? I'm using the JavaScript elasticsearch client.

---

<div class="post-metadata">

**Author:** ![nik9000](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nik9000/32/44947_2.png) [@nik9000](https://discuss.elastic.co/u/nik9000)\
**Post date:** [September 27, 2016, 10:19pm UTC](https://discuss.elastic.co/t/is-hits-total-limited-by-max-results-window/61647/2 "2016-09-27T22:19:09Z")

</div>

`hits.total` is limited by [`terminate_after`](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html#_parameters_4). `max_result_window` is just the biggest min-heap we allow ES to build per shard for collecting the actual results. `hits.total` is just a count of the hits so it shouldn't be limited.

---

<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 5, 2017, 10:16pm UTC](https://discuss.elastic.co/t/is-hits-total-limited-by-max-results-window/61647/3 "2017-07-05T22:16:50Z")

</div>


