Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete SOLR indexed data by query with curl?

Tags:

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?

like image 374
Guray Celik Avatar asked Jan 03 '12 23:01

Guray Celik


People also ask

How remove indexed data from Solr?

To delete documents from the index of Apache Solr, we need to specify the ID's of the documents to be deleted between the <delete></delete> tags. Here, this XML code is used to delete the documents with ID's 003 and 005. Save this code in a file with the name delete.

How does Solr index data?

By adding content to an index, we make it searchable by Solr. A Solr index can accept data from many different sources, including XML files, comma-separated value (CSV) files, data extracted from tables in a database, and files in common file formats such as Microsoft Word or PDF.


1 Answers

You have to add query tag.

<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete> 
like image 143
Matej Avatar answered Sep 18 '22 17:09

Matej