I have a code like below where I\'m doing multiple must in bool query. Here I\'m passing the must term queries in field \"address\". Now the ip address will come to me as a list
If you use TermsQuery
for address array/set, it will return any documents that match with at least one or more of the provided terms.
List address = new ArrayList();
address.add("10.203.238.138");
address.add("10.203.238.137");
address.add("10.203.238.136");
BoolQueryBuilder qb = QueryBuilders.boolQuery();
qb.mustNot(QueryBuilders.termQuery("address", "10.203.238.140"));
qb.should(QueryBuilders.termQuery("client", ""));
for(String add: Address){
qb.must(QueryBuilders.termsQuery("address",add));
}