Bird
0
0

Consider this update request:

medium📝 Predict Output Q4 of 15
Elasticsearch - Document Operations
Consider this update request:
POST /products/_update/42
{
  "doc": {
    "price": 19.99
  }
}

What will be the value of the price field after this update?
AThe <code>price</code> field will be incremented by 19.99
BThe entire document will be replaced with only the <code>price</code> field set to 19.99
CThe update will fail because the entire document is required
DThe <code>price</code> field will be set to 19.99, other fields remain unchanged
Step-by-Step Solution
Solution:
  1. Step 1: Understand partial updates

    The _update API with doc updates only specified fields.
  2. Step 2: Effect on other fields

    Other fields in the document remain unchanged unless explicitly updated.
  3. Step 3: Validate options

    The price field will be set to 19.99, other fields remain unchanged correctly describes the behavior. The entire document will be replaced with only the price field set to 19.99 is incorrect because the document is not replaced. The update will fail because the entire document is required is wrong; partial updates are allowed. The price field will be incremented by 19.99 is incorrect; the field is set, not incremented.
  4. Final Answer:

    The price field will be set to 19.99, other fields remain unchanged -> Option D
  5. Quick Check:

    Update with doc modifies fields, does not replace document [OK]
Quick Trick: Update with doc changes fields, leaves others intact [OK]
Common Mistakes:
MISTAKES
  • Assuming update replaces entire document
  • Expecting increment instead of set
  • Thinking update requires full document

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes