Get total hit count from Lucene


Is there any way to get the total hit count from Lucene’s TopDocs.totalHits? It would be wonderful if that information was available somewhere in the query result, maybe through the $meta operator, because using $count in the aggregation pipeline is extremely slow depending on the size of the result set. E.g. our collection has 2 million documents, and $count takes an average of 8 seconds on a result set of ~12k hits. The pipeline has only two steps: $search followed by $count. The search step is very fast.

@Celio_Cidral We are working on exposing it. It should be available in three to nine months but it is in progress. Lots of moving parts to do it right.


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