How to delete SOLR indexed data by query with curl?

╄→гoц情女王★ 提交于 2019-11-27 14:37:51

问题


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?


回答1:


You have to add query tag.

<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete>



回答2:


In this way would be easier: curl "http://46.231.77.98:7979/solr/collection/update/?commit=true&stream.body=<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete>"

It's a simple GET request and you have just to add the parameter
stream.body=<delete><query>(cartype:stationwagon)AND(color:blue)</query></delete> to the query string.



来源:https://stackoverflow.com/questions/8719860/how-to-delete-solr-indexed-data-by-query-with-curl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!