Purge a Document by Business Key
A 4-step recipe with Elasticsearch. We can help you get access.
Recipe · 4 steps
Purge a Document by Business Key
with Elasticsearch
Find a document by business key, delete it, and verify it is unreachable by both get and search.
- Resolve the internal document id from the business key with a term query. The workflow requires exactly a match here; a zero-hit result fails the step because there is nothing to purge.
- Delete the located document by its internal id.
- Attempt a direct get of the deleted id. A 404 is the required outcome and is the first half of the erasure evidence.
- Re-run the original business key query. Zero hits is the required outcome and is the second half of the erasure evidence, confirming the document is gone from the searchable view and not only from direct retrieval.
What you'll need to have ready
- index: The index holding the document to purge.
- keyField: The keyword field carrying the business key (e.g. "email").
- keyValue: The business key value identifying the document to purge.
For your developer
Arazzo workflow elasticsearch:purge-document, 4 operations: searchDsl → deleteDocument → getDocument → searchDsl. Specs on APIs.io.