How to combine multiple filters aggregation in Elasticsearch? -
i using elasticsearch 5.3. in java client, want use filters on multiple fields using and
logic single bucket. currently, filter aggregation supports single termquery
. how code multiple termquery
in java client?
aggregationbuilders.filter("specific_session", querybuilders.termquery(field_session_id, sessionid));
you need use bool query that:
boolquerybuilder filters = querybuilders.boolquery() .filter(querybuilders.termquery(field_session_id, sessionid)) .filter(querybuilders.termquery(field_xyz, xyz)); aggregationbuilders.filter("specific_session", filters);
Comments
Post a Comment