Reputation: 1281
I have a datetime field like that.
<field name="rel_date" type="date" indexed="true" stored="true" default="NOW" multiValued="false"/>
I try to delete some specific dates on rel_date field by curl query.
curl http://$SOLR_IPADDR:$SOLR_PORT/solr/update/?commit=true -H "Content-Type: text/xml" -d "<delete><query>rel_date:\[2012-03-10\])</query></delete>"
But its getting Invalid date string error on SOLR response.
HTTP Status 400 - Invalid Date String:'[2012-03-10]'
How can I delete specific dates on SOLR records with CURL query?
Upvotes: 1
Views: 3106
Reputation: 41
curl http://host:port/solr/core_name/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>rel_date:[2019-03-25T00:00:01Z TO 2019-03-25T23:59:59Z]</query></delete>'
Upvotes: 0
Reputation: 1281
I did it with following curl comment:
curl http://$SOLR_IPADDR:$SOLR_PORT/solr/update/?commit=true -H "Content-Type: text/xml" -d "(rel_date:[2012-03-10T00:00:00Z TO 2012-03-10T00:00:00Z])"
Of cource you have to change $SOLR_IPADDR and $SOLR_PORT from your environment.
Upvotes: 0
Reputation: 99730
You need the time as well.
From the DateField javadocs:
A date field shall be of the form 1995-12-31T23:59:59Z The trailing "Z" designates UTC time and is mandatory (See below for an explanation of UTC). Optional fractional seconds are allowed, as long as they do not end in a trailing 0 (but any precision beyond milliseconds will be ignored). All other parts are mandatory.
See also: http://lucidworks.lucidimagination.com/display/lweug/Solr+Date+Format
Upvotes: 3