---
title: "map_contains function in Strata | Oplema"
description: "Check whether a map contains a given key, returning true or false. Write it as map_contains(map, key) in a Strata Formula or Filter."
url: "https://oplema.com/docs/strata/functions/map-contains"
updated: "2026-11-04"
---

# map\_contains

Check whether a map has a given key.

## Try an expression

In [Formula](https://oplema.com/docs/strata/prep/formula), enter the expression and set Output type to **BOOLEAN**.

### Expression

```
map_contains(MAP {'key1': 10, 'key2': 20, 'key3': 30}, 'key2')
```

### Result

```
true
```

To use your own data, replace the example values with column names. Keep format strings and other options as written.

This Boolean expression also works in [Filter](https://oplema.com/docs/strata/prep/filter) custom mode. For the literal inputs above, the row goes to the True output. A missing result goes to False.

Try it live in Formula

Result
| id | result |
| --- | --- |
| 1 | true |

## Arguments and types

```
map_contains(map, key)
```

**map**

Map

**key**

Any value

Supported signatures (1)

```
map_contains(map: MAP(K, V), key: K) → BOOLEAN
```

The result type can depend on the input types. See DuckDB for the full argument rules.

## Things to know

If the first argument is missing, the result is NULL.

## Related functions

[element\_at

Look up a key in a map and return its value inside a list, or an empty list if the key is absent. The key must have the same type as the map's keys.

](https://oplema.com/docs/strata/functions/element-at)[map\_extract

Look up a key in a map and return its value inside a list, or an empty list if the key is absent. The key must have the same type as the map's keys.

](https://oplema.com/docs/strata/functions/map-extract)[map\_extract\_value

Look up a key in a map and return its value, or a missing value if the key is absent. The key must have the same type as the map's keys.

](https://oplema.com/docs/strata/functions/map-extract-value)[cardinality

Count the entries in a map.

](https://oplema.com/docs/strata/functions/cardinality)

[Browse maps](https://oplema.com/docs/strata/functions#maps) [DuckDB documentation](https://duckdb.org/docs/current/sql/functions/map.html#map_containsmap-key)

Function metadata from DuckDB, used under the [MIT license](https://github.com/duckdb/duckdb/blob/v1.5.4/LICENSE).
