You are looking at documentation for an older release.
Not what you want? See the
current release documentation.
Boolean Queryedit
See Boolean Query
QueryBuilder qb = QueryBuilders .boolQuery() .must(termQuery("content", "test1")) .must(termQuery("content", "test4")) .mustNot(termQuery("content", "test2")) .should(termQuery("content", "test3"));