# \_count vs track\_total\_hits

**URL:** <https://discuss.elastic.co/t/count-vs-track-total-hits/384346>\
**Category:** Elasticsearch\
**Created:** [January 3, 2026, 4:39am UTC](https://discuss.elastic.co/t/count-vs-track-total-hits/384346 "2026-01-03T04:39:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![maulik\_trapasiya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maulik_trapasiya/32/121816_2.png) [@maulik\_trapasiya](https://discuss.elastic.co/u/maulik_trapasiya)\
**Post date:** [January 3, 2026, 4:39am UTC](https://discuss.elastic.co/t/count-vs-track-total-hits/384346/1 "2026-01-03T04:39:32Z")

</div>

in my Elasticsearch index there are around 10M document, pagination based query is happening on this, on UI need to show total count of document matching query along with some data in page-format, there are 2 approach for showing count

1. track\_total\_hits set as true in request
2. make a count based query separately

which one is better? I think using separate count based query would be better as count also would be cached using request cache, while for track\_total\_hits with each request it need to re-calculate count again even if user move to the next page. am I correct?

for such decision making do I need to consider approx. how many pages each users checks?

---

<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:** [January 3, 2026, 7:15am UTC](https://discuss.elastic.co/t/count-vs-track-total-hits/384346/2 "2026-01-03T07:15:00Z")

</div>

I'd use track\_total\_hits as it will be much easier to implement.  
But: are you sure the user needs to click randomly on page 948 to read some records?

What is the exact use case?

I mean that most of time, knowing that you have more than 10 thousand hits is enough...

---

<div class="post-metadata">

**Author:** ![maulik\_trapasiya](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/maulik_trapasiya/32/121816_2.png) [@maulik\_trapasiya](https://discuss.elastic.co/u/maulik_trapasiya)\
**Post date:** [January 5, 2026, 7:22am UTC](https://discuss.elastic.co/t/count-vs-track-total-hits/384346/3 "2026-01-05T07:22:29Z")

</div>

I need to show total count on UI. each time backend need to send count

---

<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:** [January 5, 2026, 8:33am UTC](https://discuss.elastic.co/t/count-vs-track-total-hits/384346/4 "2026-01-05T08:33:47Z")

</div>

> [@maulik\_trapasiya](#):
>
> I need to show total count on UI

Does this mean that your users need to know that their search requests returns "10 012 hits" instead of saying it returns "more than 10 000 hits"?  
Google for example does not return this value.

Anyway, if your users absolutely need the exact number of hits, just add `track_total_hits`.
