Deleting a Document
Managing your index's data is an essential part of maintaining a well-organized and up-to-date search experience. HoppySearch offers a simple method to delete a particular document from your index. This allows you to remove outdated or irrelevant information effortlessly.
Follow the instructions below to delete a specific document from your HoppySearch index:
How to Delete a Document
-
Initial Configuration:
- Before you can delete a document, ensure you have configured your HoppySearch client as detailed in the initial setup documentation.
-
Delete Specific Data:
-
To delete a specific document from your index, use the following code:
-
- JavaScript
hs_guid = "15b522d8-1545-4dc9-9160-0b512f7d6997"
optionals = {
diag: true,
showStats: true
}
hoppysearch.delete(hs_guid, optionals)
.then(res => {
console.log('statusCode:', res.status);
console.log('response text:', res.body);
})
.catch(err => {
console.log(err)
}) -
hs_guid: The unique identifier (GUID) of the document you want to delete. This ensures that the correct document is removed from your index.
-
diag:
- true: Allows you to see extra diagnostics records.
- false: Omits diagnostics records.
-
showStats:
- true: Provides statistics about the deletion operation.
- false: Excludes statistics.
-
The second argument of hoppysearch.delete is not mandatory. You can customize your deletion operation according to your specific needs.
By following these steps, you can easily delete a specific document from your HoppySearch index. This feature empowers you to maintain the relevance and accuracy of your indexed data.