If you want to delete data from the Solr Index please follow below steps:
1. To remove specific document ID (Product ID)
http://<hostname>:<port>/<solr-app-name>/<core-name>update?stream.body=
<delete><query>Field Name</query></delete>&commit=true
Example:
http://localhost:8983/solr/MyCore/update?stream.body=
<delete><query>Id:298253</query></delete>&commit=true
This lets you delete document where the Id field matches 298253.
2. To remove multiple document IDs (Product IDs)
http://<hostname>:<port>/<solr-app-name>/<core-name>update?stream.body=
<delete><query>Field Name</query></delete>&commit=true
Example:
http://localhost:8983/solr/MyCore/update?stream.body=<delete><query>Id:1</query><query>Id:2</query></delete>&commit=true
This lets you delete documents where Id is 1 and 2.
3. If you want to delete documents that matches more than one field, just add another query:
http://<hostname>:<port>/<solr-app-name>/<core-name>update?stream.body=
<delete><query>Field Name</query></delete>&commit=true
Example:
http://localhost:8983/solr/MyCore/update?stream.body=
<delete><query>Manufacturer:HP</query>
<query>Category:Notebook</query></delete>&commit=true
This query lets you delete documents where Manufacturer is HP and Category is Notebook.
4. If you want to delete all documents from the index, just use this query:
http://<hostname>:<port>/<solr-app-name>/<core-name>update?stream.body=
<delete><query>*:*</query></delete>&commit=true
Example:
http://localhost:8983/solr/MyCore/update?stream.body=<delete><query>*:*</query></delete>&commit=true
Posted in: Support,