Complete the code to perform a basic match query in Elasticsearch.
{
"query": {
"match": {
"title": "[1]"
}
}
}The match query searches for the given term in the specified field.
Complete the code to add a filter for documents where the status is 'active'.
{
"query": {
"bool": {
"filter": {
"term": { "status": "[1]" }
}
}
}
}The filter restricts results to documents where status is 'active'.
Fix the error in the query to correctly combine a match and a range filter.
{
"query": {
"bool": {
"must": {
"match": { "description": "[1]" }
},
"filter": {
"range": { "price": { "gte": 10 } }
}
}
}
}The match query searches for 'discount' in the description, combined with a price filter.
Fill both blanks to create a dictionary comprehension that filters words longer than 4 characters.
{word: len(word) for word in words if [1] [2] 4}The comprehension keeps words where the length is greater than 4.
Fill all three blanks to create a dictionary comprehension that includes uppercase keys, values, and filters values greater than 0.
result = { [1]: [2] for k, v in data.items() if v [3] 0 }The comprehension creates keys in uppercase, keeps values as is, and filters values greater than zero.