Do keep one thing in mind though. If you are already doing the work of figuring out the right shard leader (through solrJ or otherwise), using that location with just the collection name might be suboptimal if there are multiple shard leaders present in the same instance -- the collection name just goes to *some* shard leader and not necessarily to the one where your document is destined. If it chooses the wrong one, it will lead to a HTTP request to itself. On 5 Nov 2014 15:33, "Shalin Shekhar Mangar" <shalinman...@gmail.com> wrote:
> There's no difference between the two. Even if you send updates to a shard > url, it will still be forwarded to the right shard leader according to the > hash of the id (assuming you're using the default compositeId router). Of > course, if you happen to hit the right shard leader then it is just an > internal forward and not an extra network hop. > > The advantage with using the collection name is that you can hit any > SolrCloud node (even the ones not hosting this collection) and it will > still work. So for a non Java client, a load balancer can be setup in front > of the entire cluster and things will just work. > > On Wed, Nov 5, 2014 at 8:50 PM, Ian Rose <ianr...@fullstory.com> wrote: > > > If I add some documents to a SolrCloud shard in a collection "alpha", I > can > > post them to "/solr/alpha/update". However I notice that you can also > post > > them using the shard name, e.g. "/solr/alpha_shard4_replica1/update" - in > > fact this is what Solr seems to do internally (like if you send documents > > to the wrong node so Solr needs to forward them over to the leader of the > > correct shard). > > > > Assuming you *do* always post your documents to the correct shard, is > there > > any difference between these two, performance or otherwise? > > > > Thanks! > > - Ian > > > > > > -- > Regards, > Shalin Shekhar Mangar. >