0

I have a solr cloud 4.4 set up with two shards.The shards are in two different machine. I have successfully indexed documents using CloudSolrServer of solr client 4.2.0. However while updating the documents some of the documents are getting updated while others are not getting updated and the exception is "org.apache.solr.common.SolrException: No active slice servicing hash code f02c79de in DocCollection(myindex)={" where "myindex" is the name of my index. The code for updating the documents is as follows:

      CloudSolrServer server = new CloudSolrServer("myip:9983");
  server.setDefaultCollection("myindex");
      List<SolrInputDocument> solrInputDocsList = new ArrayList<SolrInputDocument>();
      SolrInputDocument solrInputDoc = new SolrInputDocument();

      List<String> servicesList = new ArrayList<String>();
      servicesList.add("hockey1");
      servicesList.add("blogger1");
      Map<String, List<String>> services = new HashMap<String, List<String>>();
      services.put("set", servicesList);
      solrInputDoc.addField("services",services);


      solrInputDoc.addField("id",id);

      solrInputDocsList.add(solrInputDoc);

      server.add(solrInputDocsList);
      server.commit();

My Question are: 1) When document are indexed how it is decides which document goes to which shard. 2) Why the update for some of the documents are failing.

Vijay Tiwary
  • 151
  • 10

1 Answers1

0

For question 1, check this article http://searchhub.org/2013/06/13/solr-cloud-document-routing/

The idea is that you can tell SolrCloud to put some documents together by generating the Id field following this pattern shard_key!document_id

Everything that shares the shard_key will be placed in the same shard

For question 2, I had the same problem and I fixed it by cleaning the configuration Zookeeper had stored

Regards, Randall Rosales

Randall R
  • 21
  • 2