# How to enable track\_total\_hits=true by default for all queries?

**URL:** <https://discuss.elastic.co/t/how-to-enable-track-total-hits-true-by-default-for-all-queries/198220>\
**Category:** Elasticsearch\
**Created:** [September 5, 2019, 10:11am UTC](https://discuss.elastic.co/t/how-to-enable-track-total-hits-true-by-default-for-all-queries/198220 "2019-09-05T10:11:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![7ca884569f2642e2c488](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/7ca884569f2642e2c488/32/75102_2.png) [@7ca884569f2642e2c488](https://discuss.elastic.co/u/7ca884569f2642e2c488)\
**Post date:** [September 5, 2019, 10:11am UTC](https://discuss.elastic.co/t/how-to-enable-track-total-hits-true-by-default-for-all-queries/198220/1 "2019-09-05T10:11:00Z")

</div>

Elasticsearch 7 now requires to set track\_total\_hits=true in each request to get accurate count. We have a lot of different search templates and now need to do around 60+ changes which is not nice. Our app policy is that we always need accurate count. Is it possible via configuration? Didn't find anything about it.

---

<div class="post-metadata">

**Author:** ![jpountz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jpountz/32/45836_2.png) [@jpountz](https://discuss.elastic.co/u/jpountz)\
**Post date:** [September 13, 2019, 2:14pm UTC](https://discuss.elastic.co/t/how-to-enable-track-total-hits-true-by-default-for-all-queries/198220/2 "2019-09-13T14:14:56Z")

</div>

This isn't possible via configuration, you need to set it on every request.

---

<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:** [October 11, 2019, 2:15pm UTC](https://discuss.elastic.co/t/how-to-enable-track-total-hits-true-by-default-for-all-queries/198220/3 "2019-10-11T14:15:03Z")

</div>

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