Here's how to get distributed querying working with shards with Solr 5.0.0
- Go through http://lucene.apache.org/solr/quickstart.html (see my blog here for hints http://muddyazian.blogspot.com/2015/03/how-to-get-solr-500-quick-start.html)
- If you follow the quickstart, 2 shards are created on (i) port 8983 and (ii) port 7574. Two replicas are also created, but the important thing to note is that port 8983 has one shard, and 7574 has the other shard.
The data are automatically routed to either the 8983 shard or the 7574 shard when importing.
- A query like
http://localhost:8983/solr/gettingstarted/select?q=*:*
will query on both shards, and merge the results together
- If you only want results from one shard, then form the query like this:
http://localhost:8983/solr/gettingstarted/select?q=*:*&shards=localhost:7574/solr/gettingstarted
(Note: that you need the /gettingstarted at the end of the URL, which is something missing from the instructions at https://cwiki.apache.org/confluence/display/solr/Distributed+Requests)
Information pieced together from:
- http://lucene.apache.org/solr/quickstart.html
- Apache Solr Reference Guide (https://cwiki.apache.org/confluence/display/solr/Apache+Solr+Reference+Guide)
No comments:
Post a Comment