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

Using Solr Spellchecker from Java

Importing / Indexing MySQL data into Solr

Custom PagingNavigator for SEO friendly URL