# Elastic Search : Matching all the values from a multi-value field

**URL:** https://discuss.elastic.co/t/elastic-search-matching-all-the-values-from-a-multi-value-field/221983
**Category:** Elasticsearch
**Created:** [March 4, 2020, 5:13am UTC](https://discuss.elastic.co/t/elastic-search-matching-all-the-values-from-a-multi-value-field/221983 "2020-03-04T05:13:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Vikram.Jain](https://avatars.discourse-cdn.com/v4/letter/v/7993a0/32.png) [@Vikram.Jain](https://discuss.elastic.co/u/Vikram.Jain)
#### Post date: [March 4, 2020, 5:13am UTC](https://discuss.elastic.co/t/elastic-search-matching-all-the-values-from-a-multi-value-field/221983/1 "2020-03-04T05:13:31Z")

</div>

> [@Matching all the values from a multi-value field](https://discuss.elastic.co/t/matching-all-the-values-from-a-multi-value-field/67246):
>
> hi all! I am trying to build query that will match a document only when all the document's values in it's multi-value field are present in the given query. Example: doc1.multiField: [A, B, C] doc2.multiField: [A, B, C, D] doc3.multiField: [A, B] query.multiField: [A, B, C, E, F] So my problem is when I query for values A,B,C, E and F in my index, I want only doc1 and doc3 in my search results, because their multiField values are all contained in my query. doc2 should not be matched, bec…

I have the exact same problem as asked by  
@Bostjan_Kovac

"  
hi all!

I am trying to build query that will match a document only when all the document's values in it's multi-value field are present in the given query.

Example:

```auto
doc1.multiField: [A, B, C]
doc2.multiField: [A, B, C, D]
doc3.multiField: [A, B]

query.multiField: [A, B, C, E, F]

```

So my problem is when I query for values A,B,C, E and F in my index, I want only doc1 and doc3 in my search results, because their multiField values are all contained in my query. doc2 should not be matched, because D is not present in the query.

I am not even sure that this is possible in Elasticsearch. I've been through all the documentation and I would basically need some sort of condition where doc\*.multiField.length == doc\*.matchedCount or whatever.

minimum\_should\_match option does not cut it in my case, because it references the number of matching values from the query, whereas I need this condition on the document, which of course differs from document to document.  
"

But there are no answers. Were you able to solve this @Bostjan_Kovac ?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [April 1, 2020, 5:13am UTC](https://discuss.elastic.co/t/elastic-search-matching-all-the-values-from-a-multi-value-field/221983/2 "2020-04-01T05:13:36Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
