Elasticsearch · Arazzo Workflow

Elasticsearch Purge a Document by Business Key

Version 1.0.0

Locate a document by a business key, delete it by its internal id, and prove it is no longer retrievable or searchable.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub AnalyticsDatabaseFull-Text SearchNoSQLSearchArazzoWorkflows

Provider

elasticsearch

Workflows

purge-document
Find a document by business key, delete it, and verify it is unreachable by both get and search.
Resolves a document id from a business key, deletes the document, and confirms the deletion with a direct get expecting 404 and a repeat search expecting zero hits.
4 steps inputs: index, keyField, keyValue outputs: deleteResult, purgedDocumentId, remainingHits
1
locateDocument
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.
2
deleteDocument
Delete the located document by its internal id.
3
verifyGetFails
Attempt a direct get of the deleted id. A 404 is the required outcome and is the first half of the erasure evidence.
4
verifySearchEmpty
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.

Source API Descriptions

Arazzo Workflow Specification

Raw ↑
arazzo: 1.0.1
info:
  title: Elasticsearch Purge a Document by Business Key
  summary: Locate a document by a business key, delete it by its internal id, and prove it is no longer retrievable or searchable.
  description: >-
    The erasure path behind a data subject deletion request. A caller who must
    remove a record usually knows a business key — an email address, a customer
    id — not the internal Elasticsearch document id, so the workflow resolves one
    to the other with a term query, deletes by id, and then proves the erasure
    twice: once with a direct get that must answer 404, and once with a re-run of
    the original query that must return zero hits. Proving erasure rather than
    assuming it is the part that matters when the deletion has to be evidenced.
    Every step spells out its request inline so the flow can be read and executed
    without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: documentApi
  url: ../openapi/elasticsearch-document-api-openapi.yml
  type: openapi
- name: searchApi
  url: ../openapi/elasticsearch-search-api-openapi.yml
  type: openapi
workflows:
- workflowId: purge-document
  summary: Find a document by business key, delete it, and verify it is unreachable by both get and search.
  description: >-
    Resolves a document id from a business key, deletes the document, and
    confirms the deletion with a direct get expecting 404 and a repeat search
    expecting zero hits.
  inputs:
    type: object
    required:
    - index
    - keyField
    - keyValue
    properties:
      index:
        type: string
        description: The index holding the document to purge.
      keyField:
        type: string
        description: The keyword field carrying the business key (e.g. "email").
      keyValue:
        type: string
        description: The business key value identifying the document to purge.
  steps:
  - stepId: locateDocument
    description: >-
      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.
    operationId: searchDsl
    parameters:
    - name: index
      in: path
      value: $inputs.index
    requestBody:
      contentType: application/json
      payload:
        query:
          term:
            $inputs.keyField: $inputs.keyValue
        size: 1
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.hits.total.value > 0
      type: jsonpath
    outputs:
      documentId: $response.body#/hits/hits/0/_id
      totalHits: $response.body#/hits/total/value
  - stepId: deleteDocument
    description: >-
      Delete the located document by its internal id.
    operationId: deleteDocument
    parameters:
    - name: index
      in: path
      value: $inputs.index
    - name: id
      in: path
      value: $steps.locateDocument.outputs.documentId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      result: $response.body#/result
  - stepId: verifyGetFails
    description: >-
      Attempt a direct get of the deleted id. A 404 is the required outcome and
      is the first half of the erasure evidence.
    operationId: getDocument
    parameters:
    - name: index
      in: path
      value: $inputs.index
    - name: id
      in: path
      value: $steps.locateDocument.outputs.documentId
    successCriteria:
    - condition: $statusCode == 404
    outputs:
      getStatus: $statusCode
  - stepId: verifySearchEmpty
    description: >-
      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.
    operationId: searchDsl
    parameters:
    - name: index
      in: path
      value: $inputs.index
    requestBody:
      contentType: application/json
      payload:
        query:
          term:
            $inputs.keyField: $inputs.keyValue
        size: 1
    successCriteria:
    - condition: $statusCode == 200
    - context: $response.body
      condition: $.hits.total.value == 0
      type: jsonpath
    outputs:
      remainingHits: $response.body#/hits/total/value
  outputs:
    purgedDocumentId: $steps.locateDocument.outputs.documentId
    deleteResult: $steps.deleteDocument.outputs.result
    remainingHits: $steps.verifySearchEmpty.outputs.remainingHits

Work with this as data

Every workflow here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for arazzo workflows

4 MCP tools reach this
  • find_arazzoBrowse and filter every workflow in the catalog.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This workflow
curl "https://apis.io/api/v1/arazzo/elasticsearch-document-purge-workflow"
All arazzo workflows
curl "https://apis.io/api/v1/arazzo?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.