lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Heisey <apa...@elyograg.org>
Subject Re: List all Collections together with number of records
Date Fri, 05 Jun 2015 13:14:23 GMT
On 6/5/2015 7:00 AM, Upayavira wrote:
> I'm not so sure this is as bad as it sounds. When your collection is
> sharded, no single node knows about the documents in other shards/nodes,
> so to find the total number, a query will need to go to every node.
> 
> Trying to work out something to do a single request to every node,
> combine their collection statistics and aggregate them into a single
> result sounds very complicated, and likely overkill.
> 
> Are you needing to collect this information often? Do you have a lot of
> collections?

A query for *:* with rows=0 is quite fast on any Solr version, unless
RAM is too tight.  If your commits are infrequent, subsequent queries
for that information will even faster because they will be served from
Solr caches.

There's no reason to have user code talk to all the shards and aggregate
the document count for the collection -- let SolrCloud handle it and
just query the collection with q=*:*&rows=0.  The numFound value in the
response will cover the entire collection, and Solr will optimize the
query as much as it possibly can be optimized.

Thanks,
Shawn


Mime
View raw message