# Joining data from multiple types in visualization

**URL:** <https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968>\
**Category:** Kibana\
**Created:** [February 22, 2017, 12:23am UTC](https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968 "2017-02-22T00:23:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Reno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reno/32/15674_2.png) [@Reno](https://discuss.elastic.co/u/Reno)\
**Post date:** [February 22, 2017, 12:23am UTC](https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968/1 "2017-02-22T00:23:29Z")

</div>

Hi,  
Currently I'm using JDBC and logstash to import my SQL database into Elasticsearch. I've got three tables, which I'm putting under the same index and using a different type for each table. For ease of explanation, the types and fields look like this:

- User

- Account

- AccountUsers

Basically, an account can have multiple users, and users can belong to multiple accounts. What I'm trying to do in Kibana is visualize how many users belong to each account using a bar chart and the type 'AccountUsers' (x-axis:AccountID, y-axis:Unique count of UserID). This is working fine, but I'd prefer the x-axis labels to be 'AccountName' instead of 'AccountID'. I've done some research, and it doesn't seem like any functionality exists to use these 'AccountID's to look up the actual account name in a different document type (In my case, 'Account') and display that instead. Can anybody suggest ways I will be able to achieve this?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [February 22, 2017, 8:59pm UTC](https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968/2 "2017-02-22T20:59:56Z")

</div>

One way you could do this is to get rid of `User` and `Account` types, and simply put the `UserName` and `AccountName` records directly into the `AccountUsers` records. If you've got a lot of other data in the `User` and `Account` records, this wouldn't be as practical, however. Is that the case?

---

<div class="post-metadata">

**Author:** ![Reno](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/reno/32/15674_2.png) [@Reno](https://discuss.elastic.co/u/Reno)\
**Post date:** [February 22, 2017, 9:56pm UTC](https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968/3 "2017-02-22T21:56:19Z")

</div>

Yeah there's quite a lot of other data in the records. I've just excluded it for the sake of the question. Modifying the records themselves isn't really an option in my case.

---

<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 22, 2017, 9:56pm UTC](https://discuss.elastic.co/t/joining-data-from-multiple-types-in-visualization/75968/4 "2017-03-22T21:56:48Z")

</div>

Closed on March 22, 2017, 9:56pm UTC

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