Simple commands for deleting indexed documents in SOLR
Just a simple tip today for deleting documents in SOLR via REST API and post command. Consider that you have a collection called gettingstarted and some document with id 44C:
Via post command:
$ post -c gettingstarted -d '<delete><id>44C</id></delete>'
Via REST API:
$ curl -X POST "http://localhost:8983/solr/gettingstarted/update?commit=true" -H "Content-Type: text/xml" --data-binary "<delete><id>44C</id></delete>"
$ curl -X POST "http://localhost:8983/solr/gettingstarted/update?commit=true" -H "Content-Type: application/json" --data-binary '{"delete": {"id":"44C"}}'
You may find more scripts in my gist (delete-by-id.sh, delete-by-id2.sh & delete-by-id3.sh)
Note: Tested in SOLR 6.6 (Cloud)