# Query multiple mapping indices in visualization

**URL:** https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971
**Category:** Kibana
**Created:** [August 14, 2020, 8:09am UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971 "2020-08-14T08:09:03Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![InfiniteDreamer](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@InfiniteDreamer](https://discuss.elastic.co/u/InfiniteDreamer)
#### Post date: [August 14, 2020, 8:09am UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/1 "2020-08-14T08:09:03Z")

</div>

we have a index pattern with few indices with two different mapping, few fields are present in both mapping.  
we want bucket the common fields from both mapping indices and want to perform metric aggs on data from both mapping indices to be in same visualization.

How to query different mapping index simultaneously to group fields on bucket level?

Index Pattern = customer\_entity\*  
Indices= customer\_entity\_sales, customer\_entity\_visit

```auto
Sample:
Index => "customer_entity_sales"
Customer Code VolumeOfSale	GrossSale
XYZABC 123456789 10,929 70,121.3

Index => "customer_entity_visit"
Customer Code LastVisitDate DayOfWeek		
XYZABC 123456789 Aug 3, 2020 @ 00:00 2			

```

* * *

table vizualization for index pattern "customer\_entity\*"

```auto
Customer Code VolumeOfSale	GrossSale	LastVisitDate DayOfWeek
XYZABC 123456789 10,929 70,121.3 Aug 3, 2020 @ 00:00	2

```

Kindly let us know how to achieve this?

---

<div class="post-metadata">

### Author: ![InfiniteDreamer](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@InfiniteDreamer](https://discuss.elastic.co/u/InfiniteDreamer)
#### Post date: [August 17, 2020, 5:05am UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/2 "2020-08-17T05:05:56Z")

</div>

Kindly Help

---

<div class="post-metadata">

### Author: ![myasonik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/myasonik/32/62369_2.png) [@myasonik](https://discuss.elastic.co/u/myasonik)
#### Post date: [August 20, 2020, 7:17pm UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/3 "2020-08-20T19:17:39Z")

</div>

Sounds like you already have an index pattern that covers the indices you need. Visualizations can be created using any index pattern as a source which will use data from both indices.

You can read more about it in our docs: [https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/multi-index.html)

---

<div class="post-metadata">

### Author: ![InfiniteDreamer](https://avatars.discourse-cdn.com/v4/letter/i/779978/32.png) [@InfiniteDreamer](https://discuss.elastic.co/u/InfiniteDreamer)
#### Post date: [August 20, 2020, 7:46pm UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/4 "2020-08-20T19:46:33Z")

</div>

Thanks @myasonik ,

Both of the index have different mapping which we defined in index pattern.

In Viz i have a data table, where bucket terms are present in both different index mapping. In metrics i want to have max date from ` customer_entity_visit` which is not available in ` customer_entity_sales` and vice versa sum of gross sales available only on sales index not on visit.

Problem is either first metric is showing result and another metric is showing null or zero value. If i move the second aggregation to first place then previous one becomes null or zero. I want to show both metrics on table which have common bucket terms among each different indices.

---

<div class="post-metadata">

### Author: ![myasonik](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/myasonik/32/62369_2.png) [@myasonik](https://discuss.elastic.co/u/myasonik)
#### Post date: [August 20, 2020, 9:32pm UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/5 "2020-08-20T21:32:36Z")

</div>

I'm not sure I totally follow...

It sounds like you want to create 1 data table, of two indices, with some overlapping data. And then you want to perform some operations on the data based on a field that only exists in one index and not the other... Is that second part correct?

If I understood correctly, I don't think that's something you can accomplish.

---

<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: [September 17, 2020, 9:32pm UTC](https://discuss.elastic.co/t/query-multiple-mapping-indices-in-visualization/244971/6 "2020-09-17T21:32:50Z")

</div>

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