I'm getting following exception while trying to upload document on
SolrCloud using CloudSolrServer.
Exception in thread "main" org.apache.solr.common.SolrException:
*Could not find collection :* gettingstarted
at
org.apache.solr.common.cloud.ClusterState.getCollection(ClusterState.java:162)
at
org.apache.solr.client.solrj.impl.CloudSolrServer.directUpdate(CloudSolrServer.java:305)
at
org.apache.solr.client.solrj.impl.CloudSolrServer.request(CloudSolrServer.java:533)
at
org.apache.solr.client.solrj.request.AbstractUpdateRequest.process(AbstractUpdateRequest.java:124)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:116)
at org.apache.solr.client.solrj.SolrServer.add(SolrServer.java:102)
at Test.addDocumentSolrCloud(Test.java:265)
at Test.main(Test.java:284)
I can query through Solr admin, able to upload document using
HttpSolrServer (single instance - non cloud mode) but CloudSolrServer. I've
also verified the collection exists on zookeeper using zkCli command.
Following is the code snippet
CloudSolrServer server = new CloudSolrServer("localhost:2181");
server.setDefaultCollection("gettingstarted");
SolrInputDocument doc = new SolrInputDocument();
doc.addField("id", id);
doc.addField("name", name);
server.add(doc);
server.commit();
Not sure what I'm missing. My Zookeeper is running externally with two solr
nodes on same mac
--
Regards,
*Adnan Yaqoob*