Bird
0
0

How do you specify a manual document ID when indexing a document in Elasticsearch using the REST API?

easy📝 Syntax Q3 of 15
Elasticsearch - Document Operations
How do you specify a manual document ID when indexing a document in Elasticsearch using the REST API?
APOST /index/_doc { "_id": "manual_id", "field": "value" }
BPUT /index/_doc/manual_id { "field": "value" }
CPOST /index/_doc/manual_id { "field": "value" }
DPUT /index/_doc { "id": "manual_id", "field": "value" }
Step-by-Step Solution
Solution:
  1. Step 1: Use PUT method

    Manual document IDs require using PUT with the ID in the URL path.
  2. Step 2: Specify the index and type

    Use /index/_doc/manual_id to indicate the manual ID.
  3. Final Answer:

    PUT /index/_doc/manual_id { "field": "value" } -> Option B
  4. Quick Check:

    Manual ID in URL with PUT [OK]
Quick Trick: Manual IDs go in URL with PUT method [OK]
Common Mistakes:
MISTAKES
  • Using POST instead of PUT for manual IDs
  • Including _id inside the JSON body
  • Using 'id' instead of '_id' in the body

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes