Complete the code to create a saved search with a name.
{
"name": "[1]",
"query": {
"match_all": {}
}
}The name field sets the saved search name.
Complete the code to add a filter that matches documents where 'status' is 'active'.
{
"query": {
"bool": {
"filter": {
"term": { "status": "[1]" }
}
}
}
}The filter matches documents where the 'status' field equals 'active'.
Fix the error in the saved search filter to correctly filter documents with 'age' greater than 30.
{
"query": {
"range": {
"age": { "[1]": 30 }
}
}
}The gt operator means 'greater than', which filters ages above 30.
Fill both blanks to create a saved search that filters documents where 'category' is 'books' and 'price' is less than 20.
{
"query": {
"bool": {
"filter": [
{ "term": { "category": "[1]" } },
{ "range": { "price": { "[2]": 20 } } }
]
}
}
}The term filter matches 'books' category, and the range filter uses 'lt' for price less than 20.
Fill all three blanks to create a saved search that filters documents where 'author' is 'Alice', 'year' is greater than 2015, and 'rating' is at least 4.
{
"query": {
"bool": {
"filter": [
{ "term": { "author": "[1]" } },
{ "range": { "year": { "[2]": 2015 } } },
{ "range": { "rating": { "[3]": 4 } } }
]
}
}
}The term filter matches author 'Alice'. The year filter uses 'gt' for greater than 2015. The rating filter uses 'gte' for rating at least 4.