Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to delete a document by its ID.
Elasticsearch
DELETE /my_index/_doc/[1] Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the index name instead of the document ID.
Using
doc or other keywords instead of the actual ID.✗ Incorrect
The document ID to delete is specified after _doc/. Here, my_id is the correct ID placeholder.
2fill in blank
mediumComplete the JSON body to delete documents matching a condition.
Elasticsearch
{
"query": {
"term": { "status": [1] }
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not using quotes around the string value.
Using the field name instead of the value.
✗ Incorrect
The value for the term query must be a string in quotes, like "active".
3fill in blank
hardFix the error in the delete by query request.
Elasticsearch
POST /my_index/_delete_by_query
{
"query": {
"match": { "[1]": "obsolete" }
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the value instead of the field name as the key.
Using keywords like
query or delete as field names.✗ Incorrect
The field name to match must be specified, here it is status.
4fill in blank
hardFill both blanks to delete documents where age is greater than 30.
Elasticsearch
{
"query": {
"range": {
"age": { "[1]": [2] }
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
lt instead of gt.Putting the number 30 in quotes.
✗ Incorrect
The range query uses gt for 'greater than' and the value 30 to filter ages above 30.
5fill in blank
hardFill all three blanks to delete documents with status 'inactive' and priority less than 5.
Elasticsearch
{
"query": {
"bool": {
"must": [
{ "term": { "status": [1] } },
{ "range": { "priority": { "[2]": [3] } } }
]
}
}
} Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the status string.
Putting the number 5 in quotes.
Using wrong range operator like
gt.✗ Incorrect
The term query needs the string "inactive". The range query uses lt for less than and the number 5 without quotes.