• Home
  • LLMs
  • Docker
  • Kubernetes
  • Java
  • Maven
  • About
Apache Solr | delete (collection) command
  1. delete command help
  2. Example

  1. delete command help
    $ ${SOLR_ROOT}/bin/solr delete -help
    Usage: solr delete [-c collectionName] [-deleteConfig boolean] [-p port] [-V]
    
    The default behavior is to also delete the configuration directory from ZooKeeper so long as it is not being used by another collection.
    You can override this behavior by passing -deleteConfig false when running this command.
    
    -c collectionName
      Name of the collection to delete.
    
    -deleteConfig boolean
      Delete the configuration directory from ZooKeeper; default is true.
    
    -p port
      Port of a local Solr instance where you want to delete the collection.
      If not specified, the script will search the local system for a running Solr instance and will use the port of the first server it finds.
    
    -V
      Enables more verbose output.
  2. Example
    $ ${SOLR_ROOT}/bin/solr delete -c collection6 -deleteConfig false -p 8983

    Here's the output of running this command on my localhost where I have 2 Solr instances and 1 ZooKeeper instance.

    {
        "responseHeader": {
            "status": 0,
            "QTime": 220
        },
        "success": {
            "192.168.2.33:8983_solr": {
                "responseHeader": {
                    "status": 0,
                    "QTime": 40
                }
            },
            "192.168.2.33:8984_solr": {
                "responseHeader": {
                    "status": 0,
                    "QTime": 51
                }
            }
        }
    }
    
    Deleted collection 'collection6' using command:
    http://192.168.2.33:8983/solr/admin/collections?action=DELETE&name=collection6

    Notes:

    • The collection will be deleted from ZooKeeper.

    • For all the Solr alive instances, the collection folders (replicas) on the file system will be deleted.

    • If you set the "deleteConfig" option to "true" (default), the Solr config will be deleted from ZooKeeper.

© 2025  mtitek