{
  "id": "topk.list",
  "title": "TOPK.LIST",
  "url": "https://redis.io/docs/latest/commands/topk.list/",
  "summary": "Return the full list of items in the Top-K sketch",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-04-09T10:29:34-04:00",
  "page_type": "content",
  "content_hash": "95f7059ba8db6ff86c34cc08bf100cf98dd48955847525b3a7234c3c98334959",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "Return the full list of items in Top-K sketch."
    },
    {
      "id": "parameters",
      "title": "Parameters",
      "role": "parameters",
      "text": "* **key**: the name of the sketch.\n* **WITHCOUNT**: the count of each element is also returned."
    },
    {
      "id": "examples",
      "title": "Examples",
      "role": "example",
      "text": "[code example]\n\n[code example]"
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Supported\">&#x2705; Supported</span><br /> | <span title=\"Supported\">&#x2705; Flexible & Annual</span><br /><span title=\"Supported\">&#x2705; Free & Fixed</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "k (or less) items in the given Top-k sketch. The list is sorted by decreased count estimation.\n\n**RESP2:**\n\nOne of the following:\n\n* [Array]() of [bulk string replies]() representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array]() of [bulk string reply]() and \n[integer reply]() pairs, representing the names of the items in the sketch together with their counts.\n* [Simple error reply]() in these cases: invalid arguments, non-existant key, or key of the incorrect type.\n\n**RESP3:**\n\nOne of the following:\n\n* [Array]() of [bulk string replies]() representing the names of items in the given sketch. If `WITHCOUNT` is requested, an [array]() of [bulk string reply]() and \n[integer reply]() pairs, representing the names of the items in the sketch together with their counts.\n* [Simple error reply]() in these cases: invalid arguments, non-existant key, or key of the incorrect type."
    }
  ],
  "examples": [
    {
      "id": "examples-ex0",
      "language": "plaintext",
      "code": "TOPK.LIST topk\n1) foo\n2) 42\n3) bar",
      "section_id": "examples"
    },
    {
      "id": "examples-ex1",
      "language": "plaintext",
      "code": "TOPK.LIST topk WITHCOUNT\n1) foo\n2) (integer) 12\n3) 42\n4) (integer) 7\n5) bar\n6) (integer) 2",
      "section_id": "examples"
    }
  ]
}
