Thank you for visiting!

Please consider subscribing to the RSS feed or following me on Twitter.

Delete Documents From Solr Index By Query

If you simply want to delete documents from your Solr index by using the web interface, here's a code snippet that lets you do so:


This lets you delete documents where the id field matches 298253.

If you want to delete items that matches more than one field, just add another query:


If you want to delete all items in the index, just use this query:



Exactly what I was looking for :) Thank you!!

After re-indexing my Solr index and running cron, I queried Solr directly to ensure the locative data was added to the documents. Solr Query Coordinates. I then used the new spatial query syntax.

Saved lot of time .Thanks


How can I delete all those documents which don't contain a particular field?



this is used for <a href=''>Solr Search</a>

Thanks , It worked well

can u pls tell me for update the id from 1 to 2

In my test the url

Deleted all of BlogEntry docs!

The url below works for me.


Yeah Edinho - I got misled too and lost a lot of items! This article should be edited to include the AND!

Good info though. helped a lot.

I am trying to delete document from solr using multiple attributes but not Id.
My query is this :$name%20AND%20version:1.2%3C/query%3E%3C/delete%3E&commit=true

But when I execute this query, it doesnt delete the document from Solr but returns response.

Can you please tell me where I am wrong ?

To the top