Would you explain me the boolQuery?

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.
For more options, visit https://groups.google.com/groups/opt_out.

Hey,

Look here: 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
@dadoonet | @elasticsearchfr | @scrutmydocs

Le 29 juil. 2013 à 12:18, Henry 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.
For more options, visit https://groups.google.com/groups/opt_out.

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.
For more options, visit https://groups.google.com/groups/opt_out.