Vishal Zanzrukia
Vishal Zanzrukia

Reputation: 4973

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.

Please note, my solr is configured with basic authentication.
Solr Version : 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,

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

This gives me 401 Unauthorized response

  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,

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.

Upvotes: 1

Views: 4179

Answers (2)

Ganesa Vijayakumar
Ganesa Vijayakumar

Reputation: 2602

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
  • 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.

    <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. please alter the host and port if it is different in your end.
    • The default core name should be collection / collection1. I used collection1 in the above link. please change it too if your core name is different.

My Answer Link

Upvotes: 0

Manoj2
Manoj2

Reputation: 96

Use one of the queries below in the Document tab of Solr Admin UI:

XML:

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

JSON:

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

Make sure to select the Document Type drop down to Solr Command (raw XML or JSON).

Upvotes: 6

Related Questions