Seems solr allows to rename the core only not the collection. On 14 May 2016 at 15:06, Anil <anilk...@gmail.com> wrote:
> HI, > > Can we rename the collection ? > > if yes, action=rename with request path /admin/cores works ? Please > clarify. > > i tried following code.. but no luck. > > CloudSolrServer cloudSolrServer = new > CloudSolrServer("localhost:2181/solr"); > cloudSolrServer.setDefaultCollection("test-collection-2010"); > ModifiableSolrParams modParams = new ModifiableSolrParams(); > modParams.set(CoreAdminParams.ACTION, > CoreAdminParams.CoreAdminAction.RENAME.name()); > > // for (int i = 2010; i<= 2010; i++){ > modParams.set(CoreAdminParams.CORE, "test-collection-2010"); > modParams.set(CoreAdminParams.OTHER, "test-collection-new-2010"); > try { > QueryRequest request = new QueryRequest(modParams); > request.setPath("/admin/cores"); > System.out.println(request.toString()); > NamedList<Object> response = cloudSolrServer.request(request); > System.out.println("collection rename of 2010 is completed"); > }catch(Exception ex){ > System.out.println("collection rename of 2010 is failed"); > ex.printStackTrace(); > } > // } > > Thanks, > Anil >