Skip to content

Range Searches

Edit page

The keyword _range matches documents where the given value is between the given _from and _to fixed range (including both endpoints).

If you only use the keyword _from matches documents where the given value is greater than or equal to a fixed value.

If you only use the keyword _to matches documents where the given value is less than or equal a fixed value.

This example find all bank accounts for which their account holders are females in the ages between 20 and 30:

SEARCH /bank/
{
"_query": {
"_and": [
{ "gender": "female" },
{
"age": {
"_in": {
"_range": {
"_from": 20,
"_to": 30
}
}
}
}
]
}
}