Is it possible that you have some URIs in the database that do not have documents?
The code backing the Query Console explore button only reports the estimated number of documents:
let $total-doc := xdmp:estimate(doc())
The default behavior for cts.estimate()
is to search for any
fragment.
Only one of "any", "document", "properties", or "locks" may be specified in the options parameter. If none of "any", "document", "properties", or "locks" are specified and there is a $query parameter, then the default is "document". If there is no $query parameter then the default is "any".
Run this query and verify what numbers are reported when explicit options are specified for estimates:
const estimate_default = cts.estimate(cts.trueQuery());
const estimate_any = cts.estimate(cts.trueQuery(), ["any"]);
const estimate_documents = cts.estimate(cts.trueQuery(), ["document"]);
const estimate_properties = cts.estimate(cts.trueQuery(), ["properties"]);
const estimate_locks = cts.estimate(cts.trueQuery(), ["locks"]);
[estimate_default, estimate_any, estimate_documents, estimate_properties, estimate_locks];
I would suspect that the difference in numbers is because of some URIs that do not have documents. It is possible, for instance, to have properties fragments for a URI and not have a document.