In the current environment, developers of search applications have choices. First, cloud-based services from Google Custom Search or Amazon CloudSearch, among others, provide offerings suited for website search. In the enterprise search area, or where customization is more important including advanced analytics, the Apache Lucene libraries used by Apache Solr and Elasticsearch have gained traction.
In the case of Apache Solr, it is typical for new users to set up a
test environment in standalone mode before advancing to a distributed
search production environment using SolrCloud. During this evaluation
and testing it is common to create cores (in standalone mode) and
collections (in SolrCloud mode). After testing data sets it is common
to clean up and delete the test cases for which the
solr delete command is helpful.
solr delete command will delete
cores and collections on the Solr server as specified. It is also used
to delete associated configuration files.
solr delete command is one of 12
commands within the main
solr delete command itself has 3
options, also known as parameters.
The syntax for running
solr delete is
The list of 3 options including default values are described in the table below.
This syntax assumes your current working directory is
the $SOLR_HOME directory for Solr, which for version 7
standalone mode for a local installation. When running in a production
environment the directory locations may differ.
So the path to the location of the solr script is:
solr script can be run using the
./solr from within
When using Windows, the solr script is called using
solr delete command the
-c <name> option is required
while the other options (parameters) are optional.
||Delete the named Solr core or collection with default options.||Solr will delete the specified core and its associated configuration files at the first port number found.|
||Delete the Solr core or collection <name>.||-c <name> is required|
||Delete the Solr core or collection and the configuration files provided with -c <name> from ZooKeeper. When used, this option requires the boolean true or false. If the configuration files are used by another collection they will not be deleted, regardlesss of whether true or false was selected.||true|
||Delete the Solr core or collection on the -p <port> provided. This is useful when there are multiple standalone Solr instances running.||Solr will search for and delete the Solr instance on the first port found.|
The following command will delete the Solr core named mycore and its associated configuration files.
The following command will delete the Solr core named mycore on port 8984.
The following command will delete the Solr collection named mycollection from ZooKeeper and leave the non-default configurations saved under the directory, hypothetically called myconfigs. This is useful if the configurations saved in the directory myconfigs are to be shared by another collection.
From the command line you can access additional help on the
solr delete command by appending
-help after the command.
FactorPad offers Apache Solr Search content in both tutorials and reference.
If you prefer video tutorials for your Apache Solr learning check out our growing YouTube Channel. Subscribe here.