Bird
0
0

What will happen if you send this update request?

medium📝 Predict Output Q5 of 15
Elasticsearch - Document Operations
What will happen if you send this update request?
POST /orders/_update/1001
{
  "script": {
    "source": "ctx._source.quantity += params.count",
    "params": {"count": 3}
  }
}
AThe quantity field will increase by 3
BThe quantity field will be set to 3
CThe update will fail because scripts are not allowed
DThe entire document will be replaced with the script content
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the script update

    The script adds the parameter count (3) to the existing quantity field.
  2. Step 2: Understand script update effect

    The script modifies the field by incrementing it, not replacing or failing.
  3. Final Answer:

    The quantity field will increase by 3 -> Option A
  4. Quick Check:

    Script update increments field = The quantity field will increase by 3 [OK]
Quick Trick: Scripts can increment fields using ctx._source [OK]
Common Mistakes:
MISTAKES
  • Thinking script replaces field
  • Assuming scripts are disabled
  • Confusing script with full document replacement

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Elasticsearch Quizzes