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
track_total_hits set as true in request
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?
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.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.