There are times when you want to optimize your Solr index. But what is optimize and why do I care?
Optimize is similar to when you defragment your hard drive. Solr will create a new index removing any deleted documents. It is simply house keeping at its best.
I usually do a commit from the Admin UI, going to the overview tab.
However, sometimes we might want to do it programatically, a good example being when you have a spell checker configured to build the dictionary on optimize. The url to optimize is very simple, here is an example with my localhost, just replace with your Solr
http://localhost:8983/solr/yourcore/update?stream.body=<optimize><query>*:*</query></optimize>
Notice how the # is removed from all REST calls vs when the Admin UI loads.
Happy optimizing!