# How to exactly match multi value fields?

**URL:** <https://discuss.elastic.co/t/how-to-exactly-match-multi-value-fields/38371>\
**Category:** Elasticsearch\
**Created:** [January 5, 2016, 6:03am UTC](https://discuss.elastic.co/t/how-to-exactly-match-multi-value-fields/38371 "2016-01-05T06:03:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Youxu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/youxu/32/117375_2.png) [@Youxu](https://discuss.elastic.co/u/Youxu)\
**Post date:** [January 5, 2016, 6:03am UTC](https://discuss.elastic.co/t/how-to-exactly-match-multi-value-fields/38371/1 "2016-01-05T06:03:19Z")

</div>

I have docs something like this:

1. 

{  
"tags", ["tag11", "tag12", "tag13"]  
}

1. 

{  
"tags", ["tag21", "tag22"]  
}

I want to search for documents with exactly matched tags

e.g., if I search ["tag11", "tag12", "tag13"] it will return doc 1, but if I search ["tag11","tag12"], then Nothing return.

What is the best way ?

---

<div class="post-metadata">

**Author:** ![Ivan](https://avatars.discourse-cdn.com/v4/letter/i/df788c/32.png) [@Ivan](https://discuss.elastic.co/u/Ivan)\
**Post date:** [January 5, 2016, 6:46am UTC](https://discuss.elastic.co/t/how-to-exactly-match-multi-value-fields/38371/2 "2016-01-05T06:46:46Z")

</div>

You cannot, at least not easily. There is no simple way to match all the  
tokens in the document/field with the ones in the query (the inverse is  
easy with minimum\_match). There are a few hacks. You can index the size of  
the array and match it with the same of the query term. You could also use  
a function score script, but there is a performance penalty of course.

---

<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:** [July 5, 2017, 11:27pm UTC](https://discuss.elastic.co/t/how-to-exactly-match-multi-value-fields/38371/3 "2017-07-05T23:27:07Z")

</div>


