【问题标题】:Re: how can we delete a multiple rows in Apache Solr?回复:我们如何在 Apache Solr 中删除多行?
【发布时间】:2021-07-05 15:37:40
【问题描述】:

我需要删除大约 100 条记录,每条记录都有唯一的身份号码

他们有什么方法可以一次性删除

由于以下过程需要更多时间来处理数百万条记录

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>'

【问题讨论】:

  • 应该可以使用dataid:111...,而不是dataid:(111 OR 222 OR ...)

标签: python curl solr


【解决方案1】:

您可以在一个删除请求中传递文档的多个 id,如下所示。

Field_Name:(Value1 OR Value2 OR Value2 .. )

在你的情况下,它会像下面这样。

curl 'http://localhost:8080/solr//update'-H "Content-type: text/xml"--data-binary ' dataid : ( 18465498 OR 1878999 OR 222100)'

【讨论】:

    猜你喜欢
    • 2016-02-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-02
    • 2016-04-02
    • 1970-01-01
    • 2014-10-18
    • 2019-03-20
    相关资源
    最近更新 更多