Core
API v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

zrevrange #

Identical to zrange, except that the sorted set is traversed in descending order.

[Redis documentation]


Query Syntax #

HTTP #

URL: http://kuzzle:7512/ms/_zrevrange/<_id>?start=<index start>&stop=<index stop>[&options=withscores]
Method: GET

Other protocols #

{
  "controller": "ms",
  "action": "zrevrange",
  "_id": "<key>",
  "start": "<index start>",
  "stop": "<index stop>",
  // optional
  "options": ["withscores"]
}

Arguments #

  • _id: sorted set identifier
  • start: starting position index, inclusive
  • stop: ending position index, inclusive

Optional: #

  • withscores: return the score alongside the found elements

Response #

By default, returns the list of elements in the provided index range:

{
  "requestId": "<unique request identifier>",
  "status": 200,
  "error": null,
  "controller": "ms",
  "action": "zrange",
  "collection": null,
  "index": null,
  "result": [
    "...",
    "element2",
    "element1"
  ]
}

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": "zrange",
  "collection": null,
  "index": null,
  "result": [
    "...",
    "element2",
    "score of element2",
    "element1",
    "score of element1"
  ]
}