During early development it is common to discard an index and reload the data under a new schema. Our Managed Solr customers often ask us how to “drop” or empty a Sol index.
In the early years of SearchStax, we recommended using a delete query to empty an existing index. At that time, this was a very simple thing to do.
As time passed, however, we were forced to apply some security patches to various versions of Solr and Zookeeper, and these eventually made it cumbersome to run an /update command. People had to ask SearchStax support for assistance.
SearchStax now recommends that you “empty” an old index by deleting and recreating it. This is easy to do from the Solr Dashboard.
Delete a Collection (an Index)
To delete a collection (all parts of the same index on all nodes) open the Solr Dashboard and navigate to the Collections node:
Select the appropriate collection and use the Delete button. (Be sure to note the Shard count, configName, and replicationFactor settings.)
Recreate the Collection
Return to the Collections node and click the Add Collection button.
Fill in the appropriate parameters for the new collection. Note that numShards is almost always 1. ReplicationFactor is the number of Solr nodes in your deployment.
Don’t overlook the fact that you have to reload your data into the collection.