# How do I create visualizations with data from two indices?

**URL:** <https://discuss.elastic.co/t/how-do-i-create-visualizations-with-data-from-two-indices/117525>\
**Category:** Kibana\
**Created:** [January 29, 2018, 7:59pm UTC](https://discuss.elastic.co/t/how-do-i-create-visualizations-with-data-from-two-indices/117525 "2018-01-29T19:59:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Runcibleman](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/runcibleman/32/27106_2.png) [@Runcibleman](https://discuss.elastic.co/u/Runcibleman)\
**Post date:** [January 29, 2018, 7:59pm UTC](https://discuss.elastic.co/t/how-do-i-create-visualizations-with-data-from-two-indices/117525/1 "2018-01-29T19:59:13Z")

</div>

I have a common index pattern, say abc-index\*, which captures two indices, for example:  
abc-index-log and abc-index-users.

The log contains data on interactions by known users.  
The users index contains information about users, such as which country they are in.  
Actions by the users are identified by their unique ID in the log, and this unique ID in the users index corresponds to a number of user attributes including the country that the user is located in.

Even though I can create a visualization for the pattern abc-index\*, and pick count of searches as the y axis and the term country as the x axis, Kibana cannot produce a sensible visualization. Obviously Kibana cannot discern by itself what would be the foreign key (in database terms) in the logs is the same as the primary key in the users index. I cannot see how to point out that relationship, or any other way to be able to generate visualizations from fields of data in two indices that can be related in database terms.

Has anyone had any experience in something like this?

---

<div class="post-metadata">

**Author:** ![tylersmalley](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tylersmalley/32/8833_2.png) [@tylersmalley](https://discuss.elastic.co/u/tylersmalley)\
**Post date:** [January 30, 2018, 9:28pm UTC](https://discuss.elastic.co/t/how-do-i-create-visualizations-with-data-from-two-indices/117525/2 "2018-01-30T21:28:13Z")

</div>

I would encourage you to read the guide on [handling relationships](https://www.elastic.co/guide/en/elasticsearch/guide/current/relations.html) in Elasticsearch, as it does a good job at explaining the problem and possible solutions.

In short, you should [denormalize](https://www.elastic.co/guide/en/elasticsearch/guide/current/denormalization.html) the data and include the information from the foreign entitiy in the data you're searching.

---

<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:** [February 27, 2018, 9:30pm UTC](https://discuss.elastic.co/t/how-do-i-create-visualizations-with-data-from-two-indices/117525/3 "2018-02-27T21:30:14Z")

</div>

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