Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

how can we delete a multiple rows in Apache Solr ?

Explorer

Hi Team,

how can we delete a multiple rows in Apache Solr ? Can you please explain with CURL Command

Thanks in advance...!!!

Regards,

Satya Nittala

2 REPLIES 2

@Satya Nittala

To delete all documents

single core:

curl 'http://localhost:8080/solr/update' -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>'
curl 'http://localhost:8080/solr/update' -H "Content-type: text/xml" --data-binary '<commit />'

mutliple core:

curl 'http://localhost:8080/solr/<core-name>/update' -H "Content-type: text/xml" --data-binary '<delete><query>*:*</query></delete>' curl http://localhost:8080/solr/update -H "Content-type: text/xml" --data-binary '<commit />'

If you like to delete using a query filter instead of all, just use the filter criteria you like. For example the following will delete only the documents for city=Santiago

<delete> 
   <query>city:Santiago</query> 
</delete>

Also note the above curl commands are not specifying --negotiate -u : please add those if you have kerberos enabled cluster.

HTH

*** If you found this answer addressed your question, please take a moment to login and click the "accept" link on the answer.

Explorer

@Felix Albani

Thanks for quick response

I need to delete around 100 records , Each one having unique identity number

is their any way to delete in a single shot

Since below process is taking more time for million of records

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 101</query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 1058262 </query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 74965103</query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 1895604 </query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 1023135</query></delete>'

....

....

....

....

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 18465498</query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 1878999</query></delete>'

curl 'http://localhost:8080/solr/<core-name>/update'-H "Content-type: text/xml"--data-binary '<delete><query> dataid : 222100</query></delete>'