馃摌 The range
Operator
The range
operator is similar to equals
but works on ranges of values.
The range
operator has the following syntax. You can find more explanation about it in the documentation.
{
"$search": {
"index": <index name>, // optional, defaults to "default"
"range": {
"path": "<field-to-search>",
"gt | gte": <value-to-search>,
"lt | lte": <value-to-search>,
"score": <score-options>
}
}
}
This could be useful if you wanted to query only for books that have a range of pages. Say you only want books between 100 and 300 pages. You could use the range
operator to refine your results.