Posts: 72
Registered: ‎01-19-2017

SolrCloud collection optimization

[ Edited ]

I want to schedule a collection optimization which I daily manually perform in the Solr Admin UI,


and also I like to know How SolrCloudClient.optimize() method works in solrj library?


Becuase I want to perform a optimization in all shards of Collection which is avialble in different nodes at Single attempt for that I used below java to perform it


client = new CloudSolrClient(getZookeeperUrls());
client.setDefaultCollection("Colllection Name");
final UpdateResponse response = client.optimize();


But optimiztion happening randomly after 3 to 4 attempts of above code execution.


Eventhough the optimization happened using the java code, But still solr admin UI have optimization button in the page.


What is the difference between the manuall doing optimization in Solr Admin UI vs using Solrj Library?


What is the recommeded way to schdeule Solr Collection optimization in all shards?