Hi All, I am using below piece of code to route a data on the basis of user field. The data of user1 is going on one shard and data of user2 is going on another shard. try { String zkHostString = "127.0.0.1:2181"; CloudSolrServer cloudSolrServer = new CloudSolrServer(zkHostString); CollectionAdminRequest.createCollection("collection5", 2, 2, 2, null, null, "user", cloudSolrServer); cloudSolrServer.setDefaultCollection("collection5");
for (int i = 0; i <= 100; i++) { SolrInputDocument document = new SolrInputDocument(); document.addField("id", i); document.addField("user", "user"+(i%2)); cloudSolrServer.add(document); } cloudSolrServer.commit(); cloudSolrServer.shutdown(); } catch (SolrException e) { e.printStackTrace(); } catch (SolrServerException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } Now, I want to use routing at search time. If user search the documents for user1, then my query should be execute on only shard1 (shard1 contains the data of user1). Please let me know, how we can route the query to specific shard at search time. -- Thanks, Ankit Jain