Complete the code to update a document by setting the field 'status' to 'active'.
{
"doc": {
"status": "[1]"
}
}The field 'status' should be updated to 'active' to mark the document as active.
Complete the code to update a document by incrementing the 'views' field by 1 using a script.
{
"script": {
"source": "ctx._source.views [1] 1"
}
}The '+=' operator increments the 'views' field by 1 in the script.
Fix the error in the update request by completing the missing part to specify the document ID.
POST /my_index/_update/[1] { "doc": { "field": "value" } }
The document ID must be specified after the index in the URL to update the correct document.
Fill in the blank to update the 'price' field by multiplying it by 1.1 using a script.
{
"script": {
"source": "ctx._source.price [1] 1.1"
}
}The '*=' operator multiplies the 'price' field by 1.1 to increase it by 10%.
Fill all three blanks to update a document by setting 'status' to 'sold', incrementing 'sales' by 1, and adding a tag 'featured'.
{
"script": {
"source": "ctx._source.status = '[1]'; ctx._source.sales [2] 1; ctx._source.tags.add('[3]')"
}
}The script sets 'status' to 'sold', increments 'sales' by 1 using '+=' and adds the tag 'featured'.