23

I have a SOLR schema.xml like this:

<field name="cartype" type="lowercase" indexed="true" stored="true"/>
<field name="color" type="lowercase" indexed="true" stored="true"/>

I want to delete "blue" and "stationwagon" tagged records from SOLR database with a curl command.

But I didn't do that with following command :

curl http://46.231.77.98:7979/solr/update/?commit=true -H "Content-Type: text/xml" -d "<delete>(cartype:stationwagon)AND(color:blue)</delete>"

Do you have any suggestions?

3 Answers 3

34

You have to add query tag.

<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete>
1
  • Is this equivalent to +cartype:stationwagon +color:blue?
    – devios1
    Jun 10, 2013 at 23:51
6

Using JSON instead of XML:

curl -g "http://localhost:8983/solr/$core/update" \
     -H 'Content-Type: application/json' \
     -d '{"delete":{"query":"field:value"}}'
2

In this way would be easier:

curl -g "http://localhost:8983/solr/collection/update" \
     -d '<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete>'

curl "http://localhost:8983/solr/collection/update?commit=true"

It's a simple POST request.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.