I have
BoolQueryBuilder queryBuilder = boolQuery();
queryBuilder.filter(termQuery(...))
and now want to add a filter with a negated condition.
With
BoolQueryBuilder queryBuilder = boolQuery();
queryBuilder.filter(termQuery(...))
queryBuilder.mustNot(termQuery(...))
I didn't get the expected result.
Instead
BoolQueryBuilder queryBuilder = boolQuery();
queryBuilder.must(...);
queryBuilder.mustNot(...)
works for me.
Can someone explain this behavior? Is must/mustNot the way to go or is it with filter possible?
PS: I don't need any scoring.