# Minimum\_match

**URL:** <https://discuss.elastic.co/t/minimum-match/6254>\
**Category:** Elasticsearch\
**Created:** [December 29, 2011, 9:11pm UTC](https://discuss.elastic.co/t/minimum-match/6254 "2011-12-29T21:11:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kellan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kellan/32/3029_2.png) [@Kellan](https://discuss.elastic.co/u/Kellan)\
**Post date:** [December 29, 2011, 9:11pm UTC](https://discuss.elastic.co/t/minimum-match/6254/1 "2011-12-29T21:11:13Z")

</div>

I'm attempting to use the terms query syntax suggested in  
[http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html](http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html)  
i.e. { "terms" : { "tags" : ["blue", "red"], "minimum\_match" :  
2 } }. In this case I would like my results to match both "blue" and  
"red", but I'm getting all results that match one or the other. Is  
this the proper way to write the query? I thought {"and" :  
[{ "term" : { "tags" : "blue"} }, {"term": {"tags": "red"} }]} may be  
slower since the search didn't necessarily know the term queries were  
looking at the same field. Thoughts?

Kellan

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [December 30, 2011, 11:35am UTC](https://discuss.elastic.co/t/minimum-match/6254/2 "2011-12-30T11:35:05Z")

</div>

Yes, it should work, want to gist a sample showing it doen't?

On Thu, Dec 29, 2011 at 11:11 PM, Kellan [wampleek@gmail.com](mailto:wampleek@gmail.com) wrote:

> I'm attempting to use the terms query syntax suggested in  
> [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/terms-query.html)  
> i.e. { "terms" : { "tags" : ["blue", "red"], "minimum\_match" :  
> 2 } }. In this case I would like my results to match both "blue" and  
> "red", but I'm getting all results that match one or the other. Is  
> this the proper way to write the query? I thought {"and" :  
> [{ "term" : { "tags" : "blue"} }, {"term": {"tags": "red"} }]} may be  
> slower since the search didn't necessarily know the term queries were  
> looking at the same field. Thoughts?
> 
> Kellan

---

<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 6, 2017, 3:44am UTC](https://discuss.elastic.co/t/minimum-match/6254/3 "2017-07-06T03:44:11Z")

</div>


