Bird
0
0

Which of the following is the correct syntax to index a document with ID "123" using PUT in Elasticsearch?

easy📝 Syntax Q12 of 15
Elasticsearch - Document Operations
Which of the following is the correct syntax to index a document with ID "123" using PUT in Elasticsearch?
APOST /index/_doc {"field": "value"}
BPOST /index/_doc/123 {"field": "value"}
CPUT /index/_doc {"field": "value"}
DPUT /index/_doc/123 {"field": "value"}
Step-by-Step Solution
Solution:
  1. Step 1: Identify correct HTTP method and URL

    To specify an ID, use PUT with the URL including the ID: /index/_doc/123.
  2. Step 2: Confirm request body format

    The body contains the document fields as JSON, e.g., {"field": "value"}.
  3. Final Answer:

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

    PUT + ID in URL = correct syntax [OK]
Quick Trick: PUT with ID in URL, POST without ID [OK]
Common Mistakes:
MISTAKES
  • Using POST with an ID in URL
  • Omitting the ID when using PUT
  • Confusing URL structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes