# Would you explain me the boolQuery?

**URL:** <https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984>\
**Category:** Elasticsearch\
**Created:** [July 29, 2013, 10:18am UTC](https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984 "2013-07-29T10:18:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henry\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henry_2/32/3449_2.png) [@Henry\_2](https://discuss.elastic.co/u/Henry_2)\
**Post date:** [July 29, 2013, 10:18am UTC](https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984/1 "2013-07-29T10:18:32Z")

</div>

Hi all.

First,  
QueryBuilders.boolQuery().must(QueryBuilders.termsQuery("search\_field",  
"term1", "term2").minimumMatch(2));

Second,  
QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("search\_field",  
"term1", "term2").minimumMatch(2));

I think, a search result will be same which are first and second case.  
What do you think about it?

I will look forward your comment.

Thank you.

- henry.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)\
**Post date:** [July 29, 2013, 12:51pm UTC](https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984/2 "2013-07-29T12:51:29Z")

</div>

Hey,

Look here: [Elasticsearch Platform — Find real-time answers at scale | Elastic](http://www.elasticsearch.org/guide/reference/query-dsl/bool-query/)

In a boolean query with no must clauses, one or more should clauses must match a document.

So with only one should clause and no must, the should clause is equivalent to the must clause.

--  
David Pilato | Technical Advocate | [Elasticsearch.com](http://Elasticsearch.com)  
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 29 juil. 2013 à 12:18, Henry [sophistlv@gmail.com](mailto:sophistlv@gmail.com) a écrit :

> Hi all.
> 
> First,  
> QueryBuilders.boolQuery().must(QueryBuilders.termsQuery("search\_field", "term1", "term2").minimumMatch(2));
> 
> Second,  
> QueryBuilders.boolQuery().should(QueryBuilders.termsQuery("search\_field", "term1", "term2").minimumMatch(2));
> 
> I think, a search result will be same which are first and second case.  
> What do you think about it?
> 
> I will look forward your comment.
> 
> Thank you.
> 
> - henry.
> 
> --  
> You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Henry\_2](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/henry_2/32/3449_2.png) [@Henry\_2](https://discuss.elastic.co/u/Henry_2)\
**Post date:** [July 29, 2013, 2:27pm UTC](https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984/3 "2013-07-29T14:27:25Z")

</div>

Thank you for your comment.  
I understood. ^^

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:24am UTC](https://discuss.elastic.co/t/would-you-explain-me-the-boolquery/12984/4 "2017-07-06T02:24:00Z")

</div>


