简体   繁体   English

无法使用发布工具或 URL 删除 solr 文档(使用查询)

[英]Not able to delete solr documents (using a query) either using post tool or URL

I am not able to delete solr documents (using a query) either using post tool or URL.我无法使用发布工具或 URL 删除 solr 文档(使用查询)。

Please note, my solr is configured with basic authentication.请注意,我的 solr 配置了基本身份验证。
Solr Version : 6.6 Solr 版本: 6.6

I tried two ways,我尝试了两种方法,

  1. Using post tool使用后期工具

./post -u username:pass -c core_name delete_by_timestamp.xml here delete_by_timestamp.xml looks like, ./post -u username:pass -c core_name delete_by_timestamp.xml这里 delete_by_timestamp.xml 看起来像,

<delete>
   <query>timestamp:[* TO 2017-04-03T10:30:30Z]</query>
</delete>

This gives me 401 Unauthorized response这给了我401 Unauthorized响应

  1. Using the URL,使用网址,

http://username:pass@{ip_address}:8983/solr/core_name/update?stream.body=<delete><query>timestamp:[* TO 2017-04-03T10:30:30Z]</query></delete>&commit=true

This gives me NullPointerException ,这给了我NullPointerException

java.lang.NullPointerException at 
org.apache.solr.query.SolrRangeQuery.createDocSet(SolrRangeQuery.java:156) at 
org.apache.solr.query.SolrRangeQuery.access$200(SolrRangeQuery.java:57) at 
org.apache.solr.query.SolrRangeQuery$ConstWeight.getSegState(SolrRangeQuery.java:412)

Any help would be appreciated.任何帮助,将不胜感激。 Thanks in advance.提前致谢。

Use one of the queries below in the Document tab of Solr Admin UI:在 Solr Admin UI 的 Document 选项卡中使用以下查询之一:

XML: XML:

<delete><query>*:*</query></delete>

JSON: JSON:

{'delete': {'query': '*:*'}}

Make sure to select the Document Type drop down to Solr Command (raw XML or JSON).确保选择文档类型下拉菜单到 Solr 命令(原始 XML 或 JSON)。

I answered a similar question.我回答了一个类似的问题。 Let's try this.让我们试试这个。

I tried the below steps.我尝试了以下步骤。 It works well.它运作良好。

  • Please make sure the SOLR server it running请确保 SOLR 服务器正在运行
  • Just click the link Delete all SOLR data which will hit and delete all your SOLR indexed datas then you will get the following details on the screen as output.只需单击删除所有 SOLR 数据链接,这将命中并删除所有 SOLR 索引数据,然后您将在屏幕上获得以下详细信息作为输出。

     <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">494</int> </lst> </response>
  • if you are not getting the above output then please make sure the following.如果您没有得到上述输出,请确保以下内容。

    • I used the default host (localhost) and port (8080) on the above link.我在上面的链接中使用了默认host (localhost) 和port (8080)。 please alter the host and port if it is different in your end.如果您的主机和端口不同,请更改主机和端口。
    • The default core name should be collection / collection1 .默认核心名称应为collection / collection1 I used collection1 in the above link.我在上面的链接中使用了collection1 please change it too if your core name is different.如果您的核心名称不同,请更改它。

My Answer Link 我的答案链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM