[[java-query-dsl-bool-query]]
==== Bool Query
See {ref}/query-dsl-bool-query.html[Bool Query]
[source,java]
--------------------------------------------------
QueryBuilder qb = boolQuery()
.must(termQuery("content", "test1")) <1>
.must(termQuery("content", "test4")) <1>
.mustNot(termQuery("content", "test2")) <2>
.should(termQuery("content", "test3")) <3>
.filter(termQuery("content", "test5")); <4>
<1> must query
<2> must not query
<3> should query
<4> a query that must appear in the matching documents but doesn't contribute to scoring.