Complete the code to delete a document by its ID.
DELETE /my_index/_doc/[1]doc or other keywords instead of the actual ID.The document ID to delete is specified after _doc/. Here, my_id is the correct ID placeholder.
Complete the JSON body to delete documents matching a condition.
{
"query": {
"term": { "status": [1] }
}
}The value for the term query must be a string in quotes, like "active".
Fix the error in the delete by query request.
POST /my_index/_delete_by_query
{
"query": {
"match": { "[1]": "obsolete" }
}
}query or delete as field names.The field name to match must be specified, here it is status.
Fill both blanks to delete documents where age is greater than 30.
{
"query": {
"range": {
"age": { "[1]": [2] }
}
}
}lt instead of gt.The range query uses gt for 'greater than' and the value 30 to filter ages above 30.
Fill all three blanks to delete documents with status 'inactive' and priority less than 5.
{
"query": {
"bool": {
"must": [
{ "term": { "status": [1] } },
{ "range": { "priority": { "[2]": [3] } } }
]
}
}
}gt.The term query needs the string "inactive". The range query uses lt for less than and the number 5 without quotes.
