# BF.MADD

> Add several items to a Bloom filter in one call, creating the filter if needed.

URL: https://docs.hotkv.com/commands/bf-madd/

```
BF.MADD key item [item ...]
```

- Group: Bloom filter
- Complexity: O(k * n), k hash functions and n items
- HotKV Cloud: all plans
- On-Premise: no license needed

`BF.MADD` adds each `item` to the Bloom filter at `key`, in order, and reports
for each one whether it was new. If the key does not exist, a filter is
created first with capacity 100, error rate 0.01 and expansion 2.

## Return value

An array with one element per item:

| Element | RESP2 | RESP3 |
| --- | --- | --- |
| Item added | Integer `1` | Boolean true |
| Item (probably) already present | Integer `0` | Boolean false |

If an item cannot be added (a full non-scaling filter, or no memory to grow),
the array ends with that error in place of the item's reply, and the items
after it are not tried. For example a non-scaling filter that fills up
mid-call replies with `1` for the items that fit and then
`ERR non scaling filter is full`.

`WRONGTYPE` if the key holds another type (as the whole reply).

## Examples

```
127.0.0.1:6379> BF.MADD tags red green red
1) (integer) 1
2) (integer) 1
3) (integer) 0
127.0.0.1:6379> BF.RESERVE tiny 0.000001 2 NONSCALING
OK
127.0.0.1:6379> BF.MADD tiny a b c d
1) (integer) 1
2) (integer) 1
3) (error) ERR non scaling filter is full
```

## Compatibility

Same as `BF.MADD` in RedisBloom.

## See also

[BF.ADD](https://docs.hotkv.com/commands/bf-add/index.md), [BF.INSERT](https://docs.hotkv.com/commands/bf-insert/index.md), [BF.MEXISTS](https://docs.hotkv.com/commands/bf-mexists/index.md)