However, AFAICT, it doesn't make a noticeable difference to performance, and introduces a possible source of error (where the self agg should return more buckets than the filter value count due to terms with different ids but same label). So I'm not going to merge it.
Placing in a PR in case it does turn out to be useful.
This PR implements https://github.com/wellcomecollection/catalogue-api/issues/712
However, AFAICT, it doesn't make a noticeable difference to performance, and introduces a possible source of error (where the self agg should return more buckets than the filter value count due to terms with different ids but same label). So I'm not going to merge it.