SearchStax Help Center


Delete Individual Documents?

SearchStax Managed Search service users sometimes confront one or more broken documents. They want to delete just those items, not reload the entire collection.

Obtaining Solr Advice

Problems with Solr data ingestion are generally out of scope for SearchStax support, except to mention that legacy data often includes illegal codes that you must remove, and most issues are ultimately traced to field misconfigurations in the schema file.

SearchStax has Solr Architects who provide Solr Advisory Services to premium clients on a contract basis. All others are advised to consult the Solr user community.

That said, it is very easy to delete or replace a single record (or small set) in the Solr index if you know how.

  • If you have created a broken document in the Solr index, you can overwrite it by issuing a new /update command with a corrected document description. The critical detail is that the new document must use the same ID as the previous one. Solr will overwrite the broken document with the corrected one.
  • If you simply want to delete the broken document (not replace it), follow the procedure on this page. If you know the document ID, or any combination of search parameters that isolates the unwanted document(s), you can delete it through the Solr Dashboard.

Isolate the Document

It would be a good practice to back up the collection before attempting to delete records.

You must formulate a query that targets exactly the right document and no others. You can do this on the Solr Dashboard query screen by finding the document and noting its unique ID number.

From your Solr Dashboard, select the appropriate collection. Click the query screen below it.

Write any query that will get the target document into the result set. Click the Execute Query button. In the results, find and copy the target document’s unique ID number. (Note: the “unique ID” field is often “id” but not always. If in doubt, look in the collection’s schema.)

We recommend using the unique ID value to target the document because it is guaranteed to hit exactly one document. There is no output telling you which documents were deleted, and no way back except to reload the collection or restore from backup.

Delete the Document

This time, navigate to the collection’s Documents screen.

Set the Document Type to XML. In the Documents field, enter

<delete><query>id:60ccb2d0c2a5c95338ac938c06e7ed45</query></delete>

Note that the field name and value do not have quotes around them in this view.

Click the Submit Document button. It is likely that you won’t see any change on this screen, but if you go back to the query screen and search for your document, it won’t be there.

Questions?

Do not hesitate to contact the SearchStax Support Desk.


Return to Frequently Asked Questions.