Alternative api for filterbuilder in Elastic search 2.3.1

Below are not supported in Elastic search 2.3.1

import org.elasticsearch.index.query.BoolFilterBuilder;
import org.elasticsearch.index.query.FilterBuilder;
import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.index.query.ScriptFilterBuilder;

PLease let me know the alternatives in ES231

Hi,
as of 2.0, queries and filters have been merged and can now be used in query context or in filter context. So for BoolFilterBuilder you can use BoolQueryBuilder, the ScriptFilterBuilder can be replaced by ScriptQueryBuilder and so on. If you then use those queries e.g. inside a bool querys filter clause, they will be treated as filters.

1 Like