Created 06-18-2018 01:36 PM
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
Created 06-18-2018 01:44 PM
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.
Created 06-19-2018 03:00 PM
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>'