zrangebyscore #
Returns all sorted set elements with a score within a provided range.
The elements are considered to be ordered from low to high scores.
Query Syntax #
HTTP #
URL: http://kuzzle:7512/ms/_zrangebyscore/<_id>?min=<min interval>&max=<max interval>[&limit=offset,count][&options=withscores]
Method: GET
Other protocols #
{
"controller": "ms",
"action": "zrangebyscore",
"_id": "<key>",
"min": "<min interval>",
"max": "<max interval>",
// optional
"limit": ["<offset>", "<count>"],
"options": ["withscores"]
}
Arguments: #
_id
: sorted set identifiermin
: minimum scoremax
: maximum score
By default, min
and max
are inclusive. Check the full Redis documentation for other options.
Optional: #
limit
: an array of 2 integers, used to limit the number of returned matching elements (similar to SELECT LIMIT offset, count in SQL). Format:[<offset>,<count>]
withscores
: return the score alongside the found elements
Response #
By default, returns the list of elements in the provided score range:
{
"requestId": "<unique request identifier>",
"status": 200,
"error": null,
"controller": "ms",
"action": "zrangebyscore",
"collection": null,
"index": null,
"result": [
"element1",
"element2",
"..."
]
}
If the withscores
option is provided, then the returned array alternates elements with their score:
{
"requestId": "<unique request identifier>",
"status": 200,
"error": null,
"controller": "ms",
"action": "zrangebyscore",
"collection": null,
"index": null,
"result": [
"element1",
"score of element1",
"element2",
"score of element2",
"..."
]
}
Edit this page on Github(opens new window)