ankitbaldua
ankitbaldua

Reputation: 273

Conditional Delete in Apache SOLR

In Apache solr I have a collection in which need to delete documents based on date column. I am able to delete all documents for one date using below xml in Request-Handler (qt) of type update:

<delete> 
   <query>load_date:"2019-02-14T00:00:00Z"</query> 
</delete>

Can we use between clause to pass date range to perform delete of all documents in a date range of say 1st to 15th Feb?

enter image description here

Upvotes: 1

Views: 777

Answers (1)

MatsLindh
MatsLindh

Reputation: 52832

A regular range query should work:

<delete> 
   <query>load_date:[2019-01-01T00:00:00Z TO 2019-02-15T00:00:00Z]</query> 
</delete>

This will include any document with 2019-02-15T00:00:00Z as it date as well. Use } instead of ] if you want to exclude any documents with load_date set to the 15th.

Upvotes: 2

Related Questions