# TOPK.QUERY

> Check whether items are currently in a Top-K list.

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

```
TOPK.QUERY key item [item ...]
```

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

`TOPK.QUERY` tells you, for each `item`, whether it is currently one of the
top items kept by the Top-K at `key`.

## Return value

An array with one element per item:

| Element | RESP2 | RESP3 |
| --- | --- | --- |
| In the list | Integer `1` | Boolean true |
| Not in the list | Integer `0` | Boolean false |

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.QUERY trending hotkv memcached
1) (integer) 1
2) (integer) 0
```

## Compatibility

Same as `TOPK.QUERY` in RedisBloom.

## See also

[TOPK.LIST](https://docs.hotkv.com/commands/topk-list/index.md), [TOPK.COUNT](https://docs.hotkv.com/commands/topk-count/index.md), [TOPK.ADD](https://docs.hotkv.com/commands/topk-add/index.md)