﻿---
title: ES|QL MV_CONTAINS function
description: 
url: https://www.elastic.co/elastic/docs-builder/docs/2990/reference/query-languages/esql/functions-operators/mv-functions/mv_contains
products:
  - Elasticsearch
---

# ES|QL MV_CONTAINS function
<applies-to>
  - Elastic Stack: Preview since 9.2
</applies-to>


## Syntax

![Embedded](https://www.elastic.co/elastic/docs-builder/docs/2990/reference/query-languages/esql/images/functions/mv_contains.svg)


## Parameters

<definitions>
  <definition term="superset">
    Expression that can be null, a single value, or multiple values.
  </definition>
  <definition term="subset">
    Expression that can be null, a single value, or multiple values.
  </definition>
</definitions>


## Description

Checks if all values yielded by the second multivalue expression are present in the values yielded by the first multivalue expression. Returns a boolean. Null values are treated as an empty set.

## Supported types


| superset        | subset          | result  |
|-----------------|-----------------|---------|
| boolean         | boolean         | boolean |
| cartesian_point | cartesian_point | boolean |
| cartesian_shape | cartesian_shape | boolean |
| date            | date            | boolean |
| date_nanos      | date_nanos      | boolean |
| double          | double          | boolean |
| geo_point       | geo_point       | boolean |
| geo_shape       | geo_shape       | boolean |
| geohash         | geohash         | boolean |
| geohex          | geohex          | boolean |
| geotile         | geotile         | boolean |
| integer         | integer         | boolean |
| ip              | ip              | boolean |
| keyword         | keyword         | boolean |
| keyword         | text            | boolean |
| long            | long            | boolean |
| text            | keyword         | boolean |
| text            | text            | boolean |
| unsigned_long   | unsigned_long   | boolean |
| version         | version         | boolean |


## Examples

```esql
ROW set = ["a", "b", "c"], element = "a"
| EVAL set_contains_element = mv_contains(set, element)
```


| set:keyword | element:keyword | set_contains_element:boolean |
|-------------|-----------------|------------------------------|
| [a, b, c]   | a               | true                         |

```esql
ROW setA = ["a","c"], setB = ["a", "b", "c"]
| EVAL a_subset_of_b = mv_contains(setB, setA)
| EVAL b_subset_of_a = mv_contains(setA, setB)
```


| setA:keyword | setB:keyword | a_subset_of_b:boolean | b_subset_of_a:boolean |
|--------------|--------------|-----------------------|-----------------------|
| [a, c]       | [a, b, c]    | true                  | false                 |

```esql
FROM airports
| WHERE mv_contains(type, ["major","military"]) AND scalerank == 9
| KEEP scalerank, name, country
```


| scalerank:integer | name:text        | country:keyword |
|-------------------|------------------|-----------------|
| 9                 | Chandigarh Int'l | India           |