Fontanka16
Fontanka16

Reputation: 1323

How to get Elasticsearch aggregates to ignore filters the in similar way as Solr facets

In Solr, you can keep the counts for certain facets despite filters being set. Is there a way to enable similar functionality for Elasticsearch Aggregates?

(I have found a few examples for the now discontinued Elasticsearch facets, but i think this question has to be answered once more for Aggregates.)

Example:

q=*      q=foo   q=foo        q=foo&filter=A:2,B:1
                 &filter=A:2                     
AggA     AggA    AggB         AggB
1(10)    1(5)    *2(5)*       *2(5)*
2(10)    2(5)
3(10)    1(10)

AggB     AggB    AggB         AggB
1(10)    1(5)    1(5)         *1(3)*
2(10)    2(5)    2(5)         2(5)
3(10)    3(0)    3(5)         3(5)

I got a suggestion on trying Global Aggretion, but the only way i can get Global Aggregation to work is like this (AggB being configured as a Global Aggregate):

    q=*      q=foo   q=foo        q=foo&filter=A:2,B:1
                     &filter=A:2                     
    AggA     AggA    AggB         AggB
    1(10)    1(5)    *2(5)*       *2(5)*
    2(10)    2(5)
    3(10)    1(10)

    AggB     AggB    AggB         AggB
    1(10)    1(10)    1(10)         1(10)
    2(10)    2(10)    2(10)         2(10)
    3(10)    3(10)    3(10)         3(10)

Upvotes: 0

Views: 85

Answers (1)

Persimmonium
Persimmonium

Reputation: 15789

You should be able to achieve this with global aggregation.

It does not allow as much flexibility as Solr, as in Solr you can have many tags and exclude only some of them, but the functionality is there.

Upvotes: 1

Related Questions