小智 61
在Solr Admin UI 的" 文档"选项卡中使用以下查询之一:
XML:
<delete><query>*:*</query></delete>
Run Code Online (Sandbox Code Playgroud)
JSON:
{'delete': {'query': '*:*'}}
Run Code Online (Sandbox Code Playgroud)
确保选择Document Type
下拉菜单Solr Command (raw XML or JSON)
.
Guy*_*nat 54
我有点作弊,但不像手工编写查询那么多.
由于我之前经历过意外删除的痛苦,我尽可能地尽可能地删除我的删除(在任何类型的数据存储中).
1)仅在左上角使用"q"参数,在Solr管理查询屏幕中运行查询.将其缩小到您确实要删除的项目.对于这个例子,我正在使用*:*
,但你可以使用像id:abcdef
或范围之类的东西.如果您有一个疯狂的复杂查询,您可能会发现更容易多次执行此操作,对于您要删除的数据的每个部分.
2)在结果的顶部,有一个灰色的URL.如果将鼠标悬停在它上面,它会变黑.这是用于获取结果的URL.右键(上下文)单击它并在新选项卡/窗口中打开它.你应该得到类似的东西:
http://localhost:8983/solr/my_core_name/select?q=*%3A*&wt=json&indent=true
Run Code Online (Sandbox Code Playgroud)
现在,我想把它变成一种删除格式.我替换了select?q=
with update?commit=true&stream.body=<delete><query>
,最后是&wt=json&indent=true
with </query></delete>
.
所以我最终得到:
http://localhost:8983/solr/my_core_name/update?commit=true&stream.body=<delete><query>*%3A*</query></delete>
Run Code Online (Sandbox Code Playgroud)
深呼吸,做任何你为了好运而做的事情,并提交网址(输入关键作品).
现在,您应该能够返回到Solr管理页面并运行原始查询并获得零结果.
Her*_*arz 12
对于每个不喜欢很多词的人:-)
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 />'
Run Code Online (Sandbox Code Playgroud)