Deleting Documents from Solr

Often when using Solr, I forget what the command is to delete documents so I’m just keeping it here. This command will both delete the documents matched by the query and commit the deletion.

http://hostname/solr/update?stream.body=<delete><query></query></delete>&commit=true

Query is format field:value. To delete all of your documents enter *:*

BTW – if you do this from a browser make sure that you close the browser window when you are finished.  I once had Firefox crash and then when it came up I opted to recover the closed windows.  This instantly executed this command and deleted all of my documents.  it was not a good feeling.

Talk to you soon,

Orville | Twitter: @orville_m

Advertisements