# TOPK.COUNT

> Return the estimated counts of items in a Top-K structure, listed or not.

URL: https://docs.hotkv.com/commands/topk-count/

```
TOPK.COUNT key item [item ...]
```

- Group: Top-K
- Complexity: O(n * depth), n being the items
- HotKV Cloud: all plans
- On-Premise: no license needed

`TOPK.COUNT` returns the estimated count of each `item` in the Top-K at
`key`, whether or not the item is currently in the list. Estimates are
approximate, especially for rare items; use
[TOPK.LIST](https://docs.hotkv.com/commands/topk-list/index.md) `WITHCOUNT` for the counts of the listed
items.

## Return value

An array with one integer per item (`0` for an item never seen), the same in
RESP2 and RESP3.

Error replies: `TopK: key does not exist`, and `WRONGTYPE` if the key holds
another type.

## Examples

```
127.0.0.1:6379> TOPK.RESERVE trending 2 50 4 0.9
OK
127.0.0.1:6379> TOPK.INCRBY trending hotkv 10 redis 4
1) (nil)
2) (nil)
127.0.0.1:6379> TOPK.COUNT trending hotkv redis memcached
1) (integer) 10
2) (integer) 4
3) (integer) 0
```

## Compatibility

Same as `TOPK.COUNT` in RedisBloom, where the command is deprecated in favor
of `TOPK.LIST WITHCOUNT`. HotKV keeps it supported.

## See also

[TOPK.LIST](https://docs.hotkv.com/commands/topk-list/index.md), [TOPK.QUERY](https://docs.hotkv.com/commands/topk-query/index.md), [TOPK.INCRBY](https://docs.hotkv.com/commands/topk-incrby/index.md)