7

I want to delete some of the documents from Solr index. Searching google I found

update?stream.body=<delete><query>id:XXXXX</query></delete>&commit=true

but when I am coping it as

http://localhost:8983/solr/#/myIndex_shard1_replica1/http://10.101.3.240:8983/solr/#/solr_Ivision_DTO_shard1_replica1

I am getting error that the page does not exists.

Is there any other way from UI where I can delete the docs.

Thanks

Piyush Kumar
  • 113
  • 1
  • 2
  • 10
  • 3
    `http://localhost:8983/solr/YOURCORE/update?stream.body=id:XXXXX&commit=true` The second URL is definitely wrong. Try something like this. Replace YOURCORE with the actual core name and id:XXXXX with a valid query, or `*:*` for all docs. – jHilscher May 25 '15 at 13:04
  • 3
    Possible duplicate of [Deleting solr documents from Solr Admin](http://stackoverflow.com/questions/23228727/deleting-solr-documents-from-solr-admin) – P.T. May 02 '16 at 19:50
  • 1
    I've just added an answer to the above mention duplicate question. If it ever gets any votes, we can probably close this one, because that question will have an answer that has votes > 0. – Guy Schalnat Aug 29 '16 at 16:54

3 Answers3

7

Now in 7.2 it's a bit different...to delete using the ui:

Go to the core's Documents page. eg: http://[your-host]:8983/solr/#/[your-core-name]/documents

Or

From the admin, select a core from the drop down at the bottom of the left side menu, then click 'Documents' from core menu

Then on the documents page

  • Change Document Type to XML

  • Enter the following XML into the Document(s) text box:

    <delete><query>id:XXXXX</query></delete>

  • Click the Submit Document button

zak
  • 776
  • 10
  • 10
4
 USE:

To delete all the document.

 http://localhost:8983/solr/TABLE_NAME/update?stream.body=%3Cdelete%3E%3Cquery%3E*:*%3C/query%3E%3C/delete%3E&commit=true

To delete specific document with given id:

 http://localhost:8983/solr/TABLE_NAME/update?stream.body=%3Cdelete%3E%3Cquery%3Eid:12%3C/query%3E%3C/delete%3E&commit=true
Prashant Singh
  • 169
  • 1
  • 6
2

You could delete documents in Apache Solr as below via UI. As preferred you could go ahead with either JSON or XML.

Steps:

  1. Go to Solr Admin UI
  2. Select a core from the drop down at the bottom of the left side menu
  3. Click 'Documents' from core menu
  4. Change Document Type to XML/ JSON
  5. Enter the right Command below as selected above: i.e. XML/ JSON
  6. Finally Click "Submit Document" button

JSON:

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

XML:

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

It will automatically commit your transaction hence no need to worry.

Du-Lacoste
  • 11,530
  • 2
  • 71
  • 51