I'd like to search with a term with some values and also allow default nullable value. Trying to write codes like below, but seems not working.
new BoolQueryBuilder().should(QueryBuilders.termsQuery(esPropertyName, values))
.mustNot(QueryBuilders.existsQuery(esPropertyName));
Just figure out a way:
QueryBuilders.boolQuery().should(QueryBuilders.termsQuery(esPropertyName, values))
.should(QueryBuilders.boolQuery().mustNot(QueryBuilders.existsQuery(esPropertyName)));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.