What's the new FilterAggregator in the java client 8

hello guys ,
i'm having hard times trying to find a way to create a FilterAggregationBuilder in the new java client 8.11 , if anyone could point me te the solution i'll be grateful

        FiltersAggregationBuilder aggregation = AggregationBuilders
                        new FiltersAggregator.KeyedFilter("filter_one", authenticationAttemptQueryBuilder),
                        new FiltersAggregator.KeyedFilter("filter_two", failedAuthenticationAttemptQueryBuilder))

Hello again ! if anyone has insights or can point me towards relevent resources , it would be appreciated

I think it should be something like this:

client.search(sr -> sr.aggregations("agg_name",
        a -> a.filters(f ->
            f.filters(fr -> fr
                    "filter_one", Query.of(q -> q.term(tq -> tq.field("foo").value("bar"))),
                    "filter_two", Query.of(q -> q.term(tq -> tq.field("foo").value("baz")))
                ))))), Void.class);

Adding some information about this forum policy:

Please be patient in waiting for responses to your question and refrain from pinging multiple times asking for a response or opening multiple topics for the same question. This is a community forum, it may take time for someone to reply to your question. For more information please refer to the Community Code of Conduct specifically the section "Be patient". Also, please refrain from pinging folks directly, this is a forum and anyone that participates might be able to assist you.

If you are in need of a service with an SLA that covers response times for questions then you may want to consider talking to us about a subscription.

It's fine to answer on your own thread after 2 or 3 days (not including weekends) if you don't have an answer.

1 Like

Thank you , that helped

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