bool-query.asciidoc 487 B

123456789101112131415161718
  1. [[java-query-dsl-bool-query]]
  2. ==== Bool Query
  3. See {ref}/query-dsl-bool-query.html[Bool Query]
  4. [source,java]
  5. --------------------------------------------------
  6. QueryBuilder qb = boolQuery()
  7. .must(termQuery("content", "test1")) <1>
  8. .must(termQuery("content", "test4")) <1>
  9. .mustNot(termQuery("content", "test2")) <2>
  10. .should(termQuery("content", "test3")); <3>
  11. --------------------------------------------------
  12. <1> must query
  13. <2> must not query
  14. <3> should query