How to delete Solr Index

To delete all documents from my Solr index, we have to issue an update request with the  stream.body parameter set to <delete><query>*:*</query></delete>, as with the following URL: 


http://<host>:<port>/solr/update?stream.body=<delete><query>*:*</query></delete>&commit=true


Just replace the placeholder with the correct details. If executed successfully the it will return a response with status = 0 and query execution time.

<response>

<lst name="responseHeader">
<int name="status">0</int>
<int name="QTime">3693</int>
</lst>
</response>



If you want to remove indexes of a particular field then specify the field name in the delete query
<delete><query>desc:*</query></delete>


You can also delete a wrongly indexed value from a particular field, just by adding the value in the delete query
<delete><query>desc:wrold</query></delete>

Comments

Popular posts from this blog

Custom PagingNavigator for SEO friendly URL

Importing / Indexing MySQL data into Solr

The Externalizable Interface