# Performance implications of \`index.max\_result\_window\` vs \`track\_total\_hits\`

**URL:** <https://discuss.elastic.co/t/performance-implications-of-index-max-result-window-vs-track-total-hits/327270>\
**Category:** Elasticsearch\
**Created:** [March 8, 2023, 12:09pm UTC](https://discuss.elastic.co/t/performance-implications-of-index-max-result-window-vs-track-total-hits/327270 "2023-03-08T12:09:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cristian\_Calara](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cristian_calara/32/118195_2.png) [@Cristian\_Calara](https://discuss.elastic.co/u/Cristian_Calara)\
**Post date:** [March 8, 2023, 12:09pm UTC](https://discuss.elastic.co/t/performance-implications-of-index-max-result-window-vs-track-total-hits/327270/1 "2023-03-08T12:09:30Z")

</div>

Hello,

For example, if we would have 50.000 results for a search query. If we really need to return an exact total number of matches and we enabled `track_total_hits` to get it. Should we just as well increase the `max_result_wndow` as we are already always counting all the records?

I guess the underlying question is - is retuning say the last 100 results (from 49.900 to 50.000) more intensive as opposed to the first 100 results (0 to 100) if we are already always counting all the records (as `track_total_hits` is true)?

Any insight would be appreciated,  
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 8, 2023, 12:21pm UTC](https://discuss.elastic.co/t/performance-implications-of-index-max-result-window-vs-track-total-hits/327270/2 "2023-03-08T12:21:15Z")

</div>

Welcome!

> Should we just as well increase the `max_result_wndow` as we are already always counting all the records?

No.

---

<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 5, 2023, 12:21pm UTC](https://discuss.elastic.co/t/performance-implications-of-index-max-result-window-vs-track-total-hits/327270/3 "2023-04-05T12:21:45Z")

</div>

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