# How to fetch 2x top hit values from 2 different indexes' documents in one table?

**URL:** <https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523>\
**Category:** Kibana\
**Created:** [April 17, 2020, 1:37pm UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523 "2020-04-17T13:37:50Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mark\_Duncan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_duncan/32/46467_2.png) [@Mark\_Duncan](https://discuss.elastic.co/u/Mark_Duncan)\
**Post date:** [April 17, 2020, 1:37pm UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/1 "2020-04-17T13:37:50Z")

</div>

Hi  
I have 2 x Elasticsearch indexes and I've made one Kibana index using the \* wildcard index name.

I'd like to present 2 top hit (latest) values in a table; one value from each Elasticsearch index - so these are 2 different documents that I want to query.

Quite simply, Kibana fetches the latest document and then presents one Top Hit value (which exists in that document), and a "-" character in place of the other value.

By setting a filter of \_index: a or b, I can toggle which value is shown.

My question, can I use the "JSON input" or other solution to show the Top Hit (latest) value for each metric, where each metric is filtered to it's respective Elastic index? Can I get an example of how to do this, please?

Thanks in advance!  
Mark

---

<div class="post-metadata">

**Author:** ![Mark\_Duncan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_duncan/32/46467_2.png) [@Mark\_Duncan](https://discuss.elastic.co/u/Mark_Duncan)\
**Post date:** [April 20, 2020, 8:40am UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/2 "2020-04-20T08:40:14Z")

</div>

anyone able to help here, please?

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [April 20, 2020, 3:21pm UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/3 "2020-04-20T15:21:29Z")

</div>

Hi @Mark_Duncan,

Not sure if this is helpful, but instead of creating `*` index, have you considered creating 2 separate visualisations (e.g. of type Metric), 1 for each index, and then display a top hit there.

And then put those 2 visualisations side by side in a dashboard?

---

<div class="post-metadata">

**Author:** ![Mark\_Duncan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_duncan/32/46467_2.png) [@Mark\_Duncan](https://discuss.elastic.co/u/Mark_Duncan)\
**Post date:** [April 21, 2020, 8:13am UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/4 "2020-04-21T08:13:08Z")

</div>

Thanks Dosant.  
Yeah, I can of course do that. Thank you.  
I am, however, trying to place the 2 metrics in the same table. I am actually using an "Enhanced Table" visualisation which is a plugin. It then allows me to calculate another metric in a new column by calculating Top Hit a x Top Hit b.

But my blocker remains getting the 2 top hit values into one table from 2 different indexes.

Cheers  
Mark

---

<div class="post-metadata">

**Author:** ![Mark\_Duncan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_duncan/32/46467_2.png) [@Mark\_Duncan](https://discuss.elastic.co/u/Mark_Duncan)\
**Post date:** [April 21, 2020, 8:48am UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/5 "2020-04-21T08:48:17Z")

</div>

Aha I think I have this resolved now 🙂  
Kibana was working as I'd hoped; the result was a tiny number and not being displayed with enough decimals for it to show up!

---

<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:** [May 19, 2020, 8:48am UTC](https://discuss.elastic.co/t/how-to-fetch-2x-top-hit-values-from-2-different-indexes-documents-in-one-table/228523/6 "2020-05-19T08:48:24Z")

</div>

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