/    /  Solr – Deleting Documents

Solr – Deleting Documents:

In this tutorial, we will learn about deleting the existing documents of an index. By Using the Request Handler we can also delete the documents that are indexed. We need to delete the documents by id or query tags.

Below is the example to delete documents in the index using the id tag value as i2007. 

<delete>

    <id>i2007</id>

</delete>

The above XML can be used to delete a document by ID in Solr. If you execute the above command in documents tab in solr, you should see nothing when you search for i2sonics.

Rollback

Rollback command in Solr will rollback all the addition and deletions you performed to the index since the last time you last commit. If you want to roll back the operations you performed, you can do by using the below command.

Syntax:

<rollback/>