You can delete a collection in three ways in the recent versions of Solr.
- You can delete the collection manually by using the
bin/solr
tool
- You can delete the collection manually via Solr Admin
- You can delete the collection by using the Collections API
- You can delete the collection by using the V2 API
Deleting a collection using the bin/solr
tool is simple. You go to your SOLR_HOME
directory and you run:
bin/solr delete -c COLLECTION_NAME
To delete a collection using the Collections API you would run a command like this:
curl 'localhost:8983/solr/admin/collections?action=DELETE&name=COLLECTION_NAME'
Finally, to use the V2 API and delete a collection using it you would do the following:
curl -XDELETE 'http://localhost:8983/api/c/COLLECTION_NAME'
If you plan on removing the collection very rarely, you can do that manually. If that is something commonly used - for example with aliases and time-based data I would suggest using the V2 API as this is the newest one and will probably replace the old APIs at some point.