# TOPK.INCRBY

> Count several occurrences of items in a Top-K list at once.

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

```
TOPK.INCRBY key item increment [item increment ...]
```

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

`TOPK.INCRBY` works like [TOPK.ADD](https://docs.hotkv.com/commands/topk-add/index.md), but counts
`increment` sightings of each item instead of one. Increments are whole
numbers from 0 to 100,000. All of them are checked before anything is
counted.

## Return value

An array with one element per item, the same shape in RESP2 and RESP3: the
item that left the list because of this one (bulk string), or nil when none
did.

Error replies:

- `TopK: key does not exist`
- `TopK: increment must be an integer greater or equal to 0 and smaller or equal to 100,000`
- `ERR wrong number of arguments for 'topk.incrby' command` for unpaired arguments.
- `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.INCRBY trending valkey 6
1) "redis"
127.0.0.1:6379> TOPK.LIST trending WITHCOUNT
1) "hotkv"
2) (integer) 10
3) "valkey"
4) (integer) 6
```

## Compatibility

Same as `TOPK.INCRBY` in RedisBloom. HotKV checks every increment first, so
an invalid one is the whole reply and nothing is counted.

## See also

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