Complete the code to create a range query that finds documents with a field "age" greater than 30.
{
"query": {
"range": {
"age": {
"[1]": 30
}
}
}
}The gt operator means "greater than". So this query finds documents where age is more than 30.
Complete the code to create a range query that finds documents with a field "price" less than or equal to 100.
{
"query": {
"range": {
"price": {
"[1]": 100
}
}
}
}The lte operator means "less than or equal to". This query finds documents where price is at most 100.
Fix the error in the range query to find documents with "date" between "2023-01-01" and "2023-12-31" inclusive.
{
"query": {
"range": {
"date": {
"gte": "2023-01-01",
"[1]": "2023-12-31"
}
}
}
}The lte operator means "less than or equal to". Using it with gte includes the full date range.
Fill both blanks to create a range query that finds documents with "score" between 50 and 100, excluding 50 but including 100.
{
"query": {
"range": {
"score": {
"[1]": 50,
"[2]": 100
}
}
}
}Use gt to exclude 50 and lte to include 100 in the range.
Fill all three blanks to create a range query that finds documents with "temperature" greater than 20, less than 30, and includes the field "boost" set to 2.0.
{
"query": {
"range": {
"temperature": {
"[1]": 20,
"[2]": 30,
"[3]": 2.0
}
}
}
}Use gt for greater than 20, lt for less than 30, and boost to increase relevance weight.