TOPK.QUERY key item [item ...]

Available in: Redis Stack

Time complexity: O(n) where n is the number of items

Checks whether an item is one of Top-K items. Multiple items can be checked at once.


  • key: Name of sketch where item is queried.
  • item: Item/s to be queried.


[] - "1" if item is in Top-K, otherwise "0".


redis> TOPK.QUERY topk 42 nonexist
1) (integer) 1
2) (integer) 0