Many searches provide a standard filter panel on the left, that allows filtering by OR within a category and AND between categories. The logic the counts that are shown for every filter entry follows the following standard.
To calculate the shown count for every filter entry, the whole filter of the search results is applied, except the filter which is coming from the category of the entry itself. One example you can find here: Find your institution
I am trying to use elasticsearch filter aggregations to get back correct counts for the filter in the same way as described above, but I don't know a way to exclude the filter of a category from the applied filter. Any suggestions?