Skip to content

Instantly share code, notes, and snippets.

@krusynth
Created December 8, 2014 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save krusynth/64e88d9a9769aed818e6 to your computer and use it in GitHub Desktop.
Save krusynth/64e88d9a9769aed818e6 to your computer and use it in GitHub Desktop.
Bash script to delete all documents from a Solr core.
# Put this at the end of your .bash_profile.
#
# Usage: clearsolr corename
clearsolr() {
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<optimize />'
curl http://localhost:8983/solr/$1/update -H "Content-type: text/xml" --data-binary '<commit />'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment