# Common properties on docs

**URL:** <https://discuss.elastic.co/t/common-properties-on-docs/263412>\
**Category:** Kibana\
**Created:** [February 5, 2021, 3:11pm UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412 "2021-02-05T15:11:38Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Faycal](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@Faycal](https://discuss.elastic.co/u/Faycal)\
**Post date:** [February 5, 2021, 3:11pm UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/1 "2021-02-05T15:11:38Z")

</div>

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":

---

<div class="post-metadata">

**Author:** ![Faycal](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@Faycal](https://discuss.elastic.co/u/Faycal)\
**Post date:** [February 8, 2021, 2:22pm UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/2 "2021-02-08T14:22:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [February 9, 2021, 9:09am UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/3 "2021-02-09T09:09:00Z")

</div>

> [@Faycal](#):
>
> I'd like to create an "heatmap" with genres on the X & Y axis and the count of users ah "heatmap":

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

---

<div class="post-metadata">

**Author:** ![Faycal](https://avatars.discourse-cdn.com/v4/letter/f/e19adc/32.png) [@Faycal](https://discuss.elastic.co/u/Faycal)\
**Post date:** [February 9, 2021, 5:13pm UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/4 "2021-02-09T17:13:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [February 10, 2021, 8:09am UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/5 "2021-02-10T08:09:44Z")

</div>

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

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

```

Then the heatmap should work.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 10, 2021, 8:10am UTC](https://discuss.elastic.co/t/common-properties-on-docs/263412/6 "2021-03-10T08:10:15Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
