Bird
0
0

You want to delete all documents from the orders index where the amount field is less than 100. Which Elasticsearch request correctly achieves this?

hard🚀 Application Q15 of 15
Elasticsearch - Document Operations

You want to delete all documents from the orders index where the amount field is less than 100. Which Elasticsearch request correctly achieves this?

ADELETE /orders/_delete_by_query { "query": { "term": { "amount": 100 } } }
BDELETE /orders/_doc { "query": { "range": { "amount": { "lt": 100 } } } }
CPOST /orders/_doc/amount_lt_100/_delete
DPOST /orders/_delete_by_query { "query": { "range": { "amount": { "lt": 100 } } } }
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct API for deleting multiple documents by condition

    _delete_by_query is used with POST to delete documents matching a query.
  2. Step 2: Check the query for amount less than 100

    The range query with "lt": 100 correctly matches documents with amount less than 100.
  3. Step 3: Verify the request method and path

    POST /orders/_delete_by_query with the correct JSON body is the proper syntax.
  4. Final Answer:

    POST /orders/_delete_by_query { "query": { "range": { "amount": { "lt": 100 } } } } -> Option D
  5. Quick Check:

    Delete by query with range and POST = correct [OK]
Quick Trick: Use POST _delete_by_query with range query for conditional deletes [OK]
Common Mistakes:
MISTAKES
  • Using DELETE method with request body (not supported)
  • Using _doc endpoint instead of _delete_by_query
  • Using term query instead of range for less than condition

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes