SearchStax Help Center


Delete Individual Documents

New users of the SearchStax Site Search solution Crawler sometimes discover that their index includes a few documents that they would like to remove. By far the easiest way to clean up a Crawler index is to delete the Crawler and create a new one as explained in Clear a Site Search Index). That said, it can seem like overkill to wipe the whole index just for one or two documents.

It is possible to run a “delete query” from a Linux Bash command window, using one of these formats depending on your App’s preferred authentication method. This is the formula using basic auth:

curl -X POST --location "<Site Search update URL>" /
-H "Content-Type: application/json" /
-d '{ "delete": { "query": "<query pattern>" } }' /
--basic --user <Site Search admin>:<admin password>

And this one uses token authentication:

curl -H "Authorization: Token <token>" /
-X POST --location "<Site Search update URL>" /
-H "Content-Type: application/json"/
-d '{ "delete": { "query": "<query pattern>" } }' 

To delete a specific document, you must write a query pattern that matches that document and no other. The easy solution is to use the document’s ID value. Turn to the Site Search Power Search screen and locate the document. The results display includes the document’s ID number. In a Crawler index, the ID is usually the webpage URL.

This is a practical example of deleting a specific page from the index using the document ID value:

curl -H "Authorization: Token 0b72ea95338eeb6f038b32b818faef940797" /
-X POST --location "https://searchcloud-1-us.searchstax.com/123456/crawler-1234/update" /
-H "Content-Type: application/json" /
-d '{ "delete": { "query": "id:\"https://www.searchstax.com/docs/hc/target-page-for-deletion/\"" } }'

Note that the data parameter (-d) contains the ID of the target page. The JSON data uses an intricate set of single-quotes (‘), double-quotes (“), and escaped double-quotes (\”), without which Solr returns a 403 error.

If any part of this is beyond your reach or experience, please contact SearchStax Support for help.

Questions?

Do not hesitate to contact the SearchStax Support Desk.


Return to Frequently Asked Questions.