Adjacency matrix aggregation
/ Adjacency_matrix, / AggregationAdjacency matrix aggregation #
A multi-bucket aggregation returning every named filter’s document set
plus their pairwise INTERSECTIONS — the cross product view of several
filters. Where
filters answers each filter separately,
this one also tells you how much they overlap, which is exactly what
co-occurrence analysis needs.
How it works #
Each named filter is evaluated against every candidate document, so a
document can carry several filter flags at once. The engine then emits
one bucket per non-empty filter (keyed by its name) and one bucket per
non-empty pair, keyed a&b with the two names in alphabetical order.
Intersections beyond pairs — no a&b&c triples — are not computed,
and empty buckets are skipped entirely, so the bucket count tops out
at n·(n−1)/2 + n.