# Combining data from two indexes with common field (ID)

**URL:** https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187
**Category:** Elasticsearch
**Created:** [May 28, 2019, 8:25pm UTC](https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187 "2019-05-28T20:25:14Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)
#### Post date: [May 28, 2019, 8:25pm UTC](https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187/1 "2019-05-28T20:25:14Z")

</div>

Hello All,

I have two different indexes, one contains a list of items, along with their ID, something like:

**Items:**

> **itemID: int**  
> itemName: text  
> itemDescription: text

Second index contains orders with a reference to that item and looks like this:

**Orders:**

> orderID: int  
> orderPrice: float  
> **ItemID: int**

I would like to create an index or a visualization that will combine information from both indexes, the result would look like this:

**Orders Detailed:**

> orderID: int  
> orderPrice: float  
> ItemID: int  
> itemName: text  
> itemDescription: text

The source data is pulled using logstash. The source of **Items** is a flat file and is a sort of a dictionary updated few times a day. **Orders** is a transactional data pulled by jdbc every minute.  
Is that something that can be achieved using Elasticsearch?

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [May 29, 2019, 7:27am UTC](https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187/2 "2019-05-29T07:27:04Z")

</div>

Hey,

joining two indices at query time is not supported. However what about joining these two data structures at index time, so that it is simple to query them? You could embed the ordered items in the order, this way everything is just a query away.

--Alex

---

<div class="post-metadata">

### Author: ![saif3r](https://avatars.discourse-cdn.com/v4/letter/s/49beb7/32.png) [@saif3r](https://discuss.elastic.co/u/saif3r)
#### Post date: [May 29, 2019, 8:24am UTC](https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187/3 "2019-05-29T08:24:47Z")

</div>

Hello @spinscale,

Thank you for the answer. I'm not sure how i could join two structured at index time. Could you shed some more light on that topic or point where I could find more information about this approach so that I could study it? I'd appreciate that.

Thanks!

---

<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: [June 26, 2019, 8:24am UTC](https://discuss.elastic.co/t/combining-data-from-two-indexes-with-common-field-id/183187/4 "2019-06-26T08:24:47Z")

</div>

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