Skip to content

Instantly share code, notes, and snippets.

@jzelenkov
Last active December 15, 2015 16:39
Show Gist options
  • Save jzelenkov/5290787 to your computer and use it in GitHub Desktop.
Save jzelenkov/5290787 to your computer and use it in GitHub Desktop.

How can I delete all documents from Solr index?

Use the "match all docs" query in a delete by query command: <delete><query>*:*</query></delete>

You must also commit after running the delete so, to empty the index, run the following two commands:

curl http://localhost:8983/solr/update --data '<delete><query>*:*</query></delete>' -H 'Content-type:text/xml; charset=utf-8'  
curl http://localhost:8983/solr/update --data '<commit/>' -H 'Content-type:text/xml; charset=utf-8'

Another strategy would be to add two bookmarks in your browser:

http://localhost:8983/solr/update?stream.body=<delete><query>*:*</query></delete>
http://localhost:8983/solr/update?stream.body=<commit/>

And use those as you're developing to clear out the index as necessary.

source: solr FAQ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment