Reputation: 2180
I'd like to delete all of the indexed data in my Solr collection, preferably via a shell command on one of the nodes itself. How can I do that?
Upvotes: 2
Views: 6002
Reputation: 104
you can use below command for command prompt
curl http://<ip_address>:8983/solr/<collection_name>/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8';
Upvotes: 0
Reputation: 2180
If you have access to the shell, use the solrctl
command with the following options:
solrctl collection --deletedocs <collection-name>
Here's the full usage output from solrctl --help
for reference:
usage: /usr/bin/solrctl [options] command [command-arg] [command [command-arg]] ...
Options:
--solr solr_uri
--zk zk_ensemble
--help
--quiet
Commands:
init [--force]
instancedir [--generate path]
[--create name path]
[--update name path]
[--get name path]
[--delete name]
[--list]
collection [--create name -s <numShards>
[-c <collection.configName>]
[-r <replicationFactor>]
[-m <maxShardsPerNode>]
[-n <createNodeSet>]]
[--delete name]
[--reload name]
[--stat name]
[--deletedocs name]
[--list]
core [--create name [-p name=value]...]
[--reload name]
[--unload name]
[--status name]
If you don't have direct access, you can use Solr's update services as described here, here, and here.
Upvotes: 5