Common properties on docs

Hello all,
i'm new on this community.
I have an index of "hits" and for each document we have two parameters:

  1. user
  2. genre

example:

doc1
user:john
genre:rock
doc2
user:john
genre:rap
doc3
user:bruce
genre:rock
doc4
user:susan
genre:blues
doc5
user:susan
genre:rock
doc6
user:bruce
genre:rap

i'd like to have a "affinity" by genre with other genres counting the "common users".

rock with rap: -> 2 user
rock with blues: -> 0 users
rap with blues:-> 0 users

I'd like to create an "heatmap" with genres on the X & Y axis and the count of users ah "heatmap":

Have you any idea?

I'd like to know the "affinity" of genres.
The question is: How many people listen the "same genres"?
For every genre: which are the genres with most affinity?

Have you tried using the heatmap visualization type for this? It should work just fine. For the x axis use a terms aggregation of genre, for the y axis another terms aggregation of genre, and for the metric use either count or cardinality of user

Hi Flash, thank you for your answer: Unfortunally the heatmap trace only the "diagonal" where the genres are "equal".

The singole document has only "one genre" so it is counted only when X and Y are equal

Ah, good point, I guess you need to transform your data for this to become possible:

user: john,
genres: ["rock", "blues"]

Then the heatmap should work.