Chris Willmore
Chris Willmore

Reputation: 133

Solr delete using negated field not working

I'm trying to delete old records which don't have field indexDate present. I am using post.jar which commits by default. The delete post is not removing the records.

Calling this does not work: java -Ddata=args -jar post.jar "-indexDate:*"

Any ideas?


Update I don't think this is currently possible in Solr. In addition to trying post.jar and direct http access, I attempted to do a delete based on negative field presence query -- all did not work. I ended up doing a search for all records without the field, then explicitly deleting each result.

Upvotes: 1

Views: 456

Answers (1)

Paige Cook
Paige Cook

Reputation: 22555

I would recommend deleting via a Delete Query to your Solr instance. So you would do something similar to the following for your case of deleting where records do not have an indexDate specified:

 curl http://localhost:8983/solr/update/?commit=true -H "Content-Type: text/xml" 
    --data-binary '<update><delete><query>-indexDate:*</query></delete></update>';

Upvotes: 1

Related Questions