Bird
0
0

Given this request to index a document:

medium📝 Predict Output Q13 of 15
Elasticsearch - Document Operations
Given this request to index a document:
POST /products/_doc
{
  "name": "Coffee Mug",
  "price": 12.99
}
What will Elasticsearch do after this request?
AIndex the document with an auto-generated ID under the 'products' index.
BReplace any existing document with ID 'products'.
CReturn an error because ID is missing.
DCreate a new index named '_doc'.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the HTTP method and URL

    The request uses POST on /products/_doc, which means index 'products' and type '_doc'.
  2. Step 2: Understand ID assignment

    Since no ID is specified, Elasticsearch generates a unique ID automatically and indexes the document.
  3. Final Answer:

    Index the document with an auto-generated ID under the 'products' index. -> Option A
  4. Quick Check:

    POST without ID = auto-generated ID [OK]
Quick Trick: POST without ID means auto ID assigned [OK]
Common Mistakes:
MISTAKES
  • Thinking missing ID causes error
  • Assuming document replaces existing one
  • Confusing index and type names

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes