BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
BoolQueryBuilder boolQueryBuilder1 = QueryBuilders.boolQuery();
for (String word : wordList) {
boolQueryBuilder1.must(QueryBuilders.termQuery(FIELD1, word));
}
BoolQueryBuilder boolQueryBuilder2 = QueryBuilders.boolQuery();
for (String word : wordList) {
boolQueryBuilder2.must(QueryBuilders.termQuery(FIELD2, word));
}
boolQueryBuilder.should(boolQueryBuilder1).should(boolQueryBuilder2);