capabilities.work

Tear Down an Index

A 4-step recipe with Elasticsearch. We can help you get access.

Recipe · 4 steps

Tear Down an Index

Safely delete an Elasticsearch index after recording its definition, then verify the deletion.

  1. Probe for the index. A 404 means there is nothing to tear down, which is a successful no-op rather than an error, so the workflow ends there.
  2. Read the index definition before deleting it, so the settings and mappings are preserved in the workflow outputs and the index can be recreated.
  3. Delete the index and every document in it. This is irreversible without the definition captured in the previous step and a fresh reload of the data.
  4. Re-probe the index. A 404 is now the desired outcome and confirms the delete was applied rather than merely acknowledged.
What you'll need to have ready
  • index: The name of the index to tear down.
For your developer

Arazzo workflow elasticsearch:teardown-index, 4 operations: indexExists → getIndex → deleteIndex → indexExists. Specs on APIs.io.