Bool filter in elastic search

I am using the bool query but while using the terms in bool I am getting the max clause issue of 1024 to overcome this I want to change my bool query in the filter bool query

if ( !poNo.isEmpty() && poNo.length()>0 )
	bool.must( QueryBuilders.queryStringQuery("*"+poNo+"*").defaultField("poNo"));
if ( orderIds!=null )
bool.must(QueryBuilders.termsQuery("id", orderIds));

Here the ordersIds is an array ant it may contain more than 1024 orderIds , flnow I want to change this bool query to the filter bool query.

I have used the filter

FilterBuilder fl = FilterBuilders.boolFilter().must(FilterBuilders.termsFilter("id",orderIds ));

But here I can't dynamically append the must clause as fl. doesn't have option of must /should /must not

HI Guys
I have solved my issue by using the filtered query

bool.must(QueryBuilders.filteredQuery(null, FilterBuilders.termsFilter("id", orderIds)));

Here by using this m not getting the max clause issue, clause does the filter also has the clause of any value as of bool 1024

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.