The current version has an issue where an empty request to /mappings uses an aggregation pipeline (even though the query is empty) which causes the document counting to have a complexity of O(n) instead of O(1).
Instead, we should determine whether the query is empty, and in that case use estimatedDocumentCount().
The current version has an issue where an empty request to
/mappings
uses an aggregation pipeline (even though the query is empty) which causes the document counting to have a complexity of O(n) instead of O(1).Instead, we should determine whether the query is empty, and in that case use
estimatedDocumentCount()
.