0
0
Elasticsearchquery~10 mins

Deleting and closing indexes in Elasticsearch - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Deleting and closing indexes
Start
Choose index
Decide action
Close index
Send close
Index closed
End
You pick an index, decide to close or delete it, send the command, and the index is closed or deleted.
Execution Sample
Elasticsearch
POST /my-index/_close

DELETE /my-index
Close an index named 'my-index' or delete it completely.
Execution Table
StepActionIndexCommand SentResult
1Choose indexmy-indexNoneReady to act
2Decide to closemy-indexPOST /my-index/_closeIndex closing started
3Index closedmy-indexNoneIndex is now closed
4Choose indexmy-indexNoneReady to act
5Decide to deletemy-indexDELETE /my-indexIndex deletion started
6Index deletedmy-indexNoneIndex is now deleted
💡 Index is closed or deleted, no further action needed.
Variable Tracker
VariableStartAfter CloseAfter Delete
index_statusopencloseddeleted
Key Moments - 2 Insights
Why does closing an index not delete its data?
Closing an index just makes it unavailable for search but keeps data on disk, as shown in step 3 where the index status changes to closed but not deleted.
What happens if you try to delete an index that is already closed?
Deleting a closed index works fine; the index is removed completely as in step 6, regardless of its closed state.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the index status after step 3?
Aopen
Bdeleted
Cclosed
Dunknown
💡 Hint
Check the 'Result' column at step 3 in the execution_table.
At which step is the delete command sent?
AStep 5
BStep 3
CStep 2
DStep 6
💡 Hint
Look for 'DELETE /my-index' in the 'Command Sent' column.
If you skip closing and directly delete, which steps are skipped?
ASteps 4 and 5
BSteps 2 and 3
CSteps 1 and 6
DNo steps skipped
💡 Hint
Closing happens at steps 2 and 3; deleting starts at step 5.
Concept Snapshot
Deleting and closing indexes:
- Closing an index makes it unavailable but keeps data.
- Deleting removes the index and data completely.
- Use POST /index/_close to close.
- Use DELETE /index to delete.
- Closed indexes can be reopened later.
Full Transcript
This visual trace shows how to delete or close an Elasticsearch index. First, you pick the index to act on. Then you decide whether to close or delete it. Closing sends a POST request to /index/_close, making the index unavailable but keeping its data. Deleting sends a DELETE request to /index, removing the index and its data completely. The variable 'index_status' changes from open to closed or deleted accordingly. Closing does not delete data, so you can reopen the index later. Deleting is permanent. The execution table tracks each step, command sent, and result, helping beginners see the process clearly.