Bird
0
0

Why does this request fail? GET /index/_doc with JSON body {"id": "5"} to retrieve document ID 5.

medium📝 Debug Q7 of 15
Elasticsearch - Document Operations
Why does this request fail? GET /index/_doc with JSON body {"id": "5"} to retrieve document ID 5.
AThe index name is missing
BThe JSON key should be '_id' not 'id'
CGET requests should not have a body; ID must be in URL path
DDocument ID must be numeric
Step-by-Step Solution
Solution:
  1. Step 1: Understand GET request usage in Elasticsearch

    GET requests to retrieve by ID require the ID in the URL path, not in the body.
  2. Step 2: Identify why the request fails

    Sending a body with GET is ignored or rejected; ID must be part of the URL.
  3. Final Answer:

    GET requests should not have a body; ID must be in URL path -> Option C
  4. Quick Check:

    ID goes in URL path, not JSON body for GET [OK]
Quick Trick: Put ID in URL path, not JSON body, for GET requests [OK]
Common Mistakes:
MISTAKES
  • Sending body with GET
  • Using wrong JSON key
  • Missing index name

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes