Migrating ES 1.7 to 2.1 - boolQuery


My experience with Elasticsearch is limited and I am trying to migrate some code from using ES 1.7 to ES 2.1.

In ES 1.7, the FilterBuilders.boolFilter().must() can accept an array of FilterBuilder and return a single one but the QueryBuilders.boolQuery().must() in ES 2.1 would only accept a single QueryBuilder.

What should I do in this situation?

Thank you.


Just do

BoolQueryBuilder boolQuery = QueryBuilders.boolQuery();
for (QueryBuilder queryBuilder : queryBuilders) {

Thank you so much. Appreciate your prompt response.