Bird
0
0

Why does the _delete_by_query API sometimes take longer to complete than deleting documents by ID?

hard🧠 Conceptual Q10 of 15
Elasticsearch - Document Operations

Why does the _delete_by_query API sometimes take longer to complete than deleting documents by ID?

ABecause it creates new documents before deleting
BBecause it searches and deletes all matching documents, which can be many
CBecause it only deletes one document at a time by ID
DBecause it requires manual confirmation for each document
Step-by-Step Solution
Solution:
  1. Step 1: Understand _delete_by_query process

    This API must search the index to find all documents matching the query before deleting them.
  2. Step 2: Compare with delete by ID

    Deleting by ID targets a single document directly, so it is faster than searching and deleting many.
  3. Final Answer:

    Because it searches and deletes all matching documents, which can be many -> Option B
  4. Quick Check:

    _delete_by_query is slower due to searching many docs [OK]
Quick Trick: _delete_by_query searches before deleting, so slower [OK]
Common Mistakes:
MISTAKES
  • Thinking it deletes only one document
  • Believing it creates documents before deleting

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes