# Kibana Aggregation between types

**URL:** <https://discuss.elastic.co/t/kibana-aggregation-between-types/108738>\
**Category:** Kibana\
**Created:** [November 22, 2017, 3:22pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738 "2017-11-22T15:22:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robert\_Naccache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robert_naccache/32/97656_2.png) [@Robert\_Naccache](https://discuss.elastic.co/u/Robert_Naccache)\
**Post date:** [November 22, 2017, 3:22pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/1 "2017-11-22T15:22:22Z")

</div>

Hi everyone,

I made another post earlier during the day, but didn't get any response. I've tried a lot of things during the day but i think understanding the issue is more important.

My question is, if i have two types under the same index that have the following fields  
index/logs  
field: jobid  
field: buisnessevent

index/errors  
field: jobid  
field: errorid

is it possible to aggregate in kibana by buisnessevent?  
i'm trying to get a list of every business event, and display how many jobs (with and without errors) per event.

From what i understand because index/errors doesn't have the buisnessevent field, i can't aggregate based on it.

thank you for the clarification,  
Robert

---

<div class="post-metadata">

**Author:** ![Robert\_Naccache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robert_naccache/32/97656_2.png) [@Robert\_Naccache](https://discuss.elastic.co/u/Robert_Naccache)\
**Post date:** [November 23, 2017, 8:09am UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/2 "2017-11-23T08:09:40Z")

</div>

Morning,

After struggling with this, in the end i chose to flatten my data from the database which solved my issue.

Thanks,  
Robert

---

<div class="post-metadata">

**Author:** ![anujjain0801](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anujjain0801](https://discuss.elastic.co/u/anujjain0801)\
**Post date:** [November 23, 2017, 9:04am UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/3 "2017-11-23T09:04:48Z")

</div>

Hi Robert,  
I also have some use case like your where I need to aggregate data based on some field and then when user clicks on the particular field it should show details of the results.

Can you please help me how you are trying to achieve this?

---

<div class="post-metadata">

**Author:** ![Robert\_Naccache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robert_naccache/32/97656_2.png) [@Robert\_Naccache](https://discuss.elastic.co/u/Robert_Naccache)\
**Post date:** [November 23, 2017, 12:01pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/4 "2017-11-23T12:01:22Z")

</div>

Hi Anujjain,

I dont know the details of your case, but i was importing data from MSSQL using JDBC drivers between three tables using logstash.

What i ended up doing was using 'Left Join' in my SQL query, instead of having two different tables, i flattened it out into one and imported. so from

**index/logs**  
field: jobid  
field: buisnessevent

**index/errors**  
field: jobid  
field: errorid

i endded up with one \_type:  
**index/logs**  
field: jobid  
field: businessevent  
field: errorid

and it doesn't matter if i have two error id for one jobid, i'll just have two entries and i can aggregate in kibana using "unique count" or "cardinality"

hope it helps.

Robert

---

<div class="post-metadata">

**Author:** ![anujjain0801](https://avatars.discourse-cdn.com/v4/letter/a/df705f/32.png) [@anujjain0801](https://discuss.elastic.co/u/anujjain0801)\
**Post date:** [November 23, 2017, 12:07pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/5 "2017-11-23T12:07:25Z")

</div>

Hi Robert,

Thank you so much for the response. I will try the way you are using it. My use case is I need to aggregate data based on correlation id or some token. Can you please let me know if we can create hyperlinks in Kibana and use it to view details of the fields.

Thanks and Regards,  
Anuj Jain

---

<div class="post-metadata">

**Author:** ![Robert\_Naccache](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/robert_naccache/32/97656_2.png) [@Robert\_Naccache](https://discuss.elastic.co/u/Robert_Naccache)\
**Post date:** [November 23, 2017, 12:15pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/6 "2017-11-23T12:15:33Z")

</div>

HI Anuj Jain,

I'm not exactly sure what you mean by hyperlinks.

If you need to view the details of a document, you can check the discover tab in kibana and on the left part of the window under 'available fields', just add the fields you want. After that you can save it as a search and add it to a dashboard (i think that's what you want).

I'm kind of new to kibana, so there might be other ways around doing what you want 🙂

---

<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:** [December 21, 2017, 12:15pm UTC](https://discuss.elastic.co/t/kibana-aggregation-between-types/108738/7 "2017-12-21T12:15:55Z")

</div>

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