# How to join two index

**URL:** https://discuss.elastic.co/t/how-to-join-two-index/292629
**Category:** Elasticsearch
**Created:** [December 22, 2021, 4:03am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629 "2021-12-22T04:03:52Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![arisxf](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@arisxf](https://discuss.elastic.co/u/arisxf)
#### Post date: [December 22, 2021, 4:03am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/1 "2021-12-22T04:03:52Z")

</div>

I've tried using aliases (aliases a and b) the results alert The data you are seeing might be incomplete or wrong. in the field at index b. Please help me

```auto
POST /_aliases
{
    "actions" : [
        { "add" : { "index" : "a", "alias" : "join_a_and_b"} },
        { "add" : { "index" : "b", "alias" : "join_a_and_b"} }
    ]
}

```

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [December 22, 2021, 4:38am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/2 "2021-12-22T04:38:40Z")

</div>

Can you elaborate more on what you are trying to do here?

---

<div class="post-metadata">

### Author: ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)
#### Post date: [December 22, 2021, 5:43am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/3 "2021-12-22T05:43:15Z")

</div>

Aliases allows you to query sets of indices using a short name rather than listing all indices individually. Elasticsearch does however not support joins between documents even if you have an aluas in place. If you can provide an example of what you are trying to achieve it may be easier to provide guidance.

---

<div class="post-metadata">

### Author: ![Divyank\_Mahalle](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/divyank_mahalle/32/91240_2.png) [@Divyank\_Mahalle](https://discuss.elastic.co/u/Divyank_Mahalle)
#### Post date: [December 22, 2021, 5:56am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/4 "2021-12-22T05:56:30Z")

</div>

You can use enrichment processor for this, but both indexes must have one field in common.

Reindexing needs to be performed in this method.

Ex-[Enrich fields in new index from other index present in kibana using logstash](https://discuss.elastic.co/t/enrich-fields-in-new-index-from-other-index-present-in-kibana-using-logstash/284397)

---

<div class="post-metadata">

### Author: ![arisxf](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@arisxf](https://discuss.elastic.co/u/arisxf)
#### Post date: [December 23, 2021, 2:07am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/5 "2021-12-23T02:07:10Z")

</div>

thank you for replying to this discussion quickly.  
so i hope like join in sql

example  
index a - transaction  
id  
location\_id  
name  
date\_report

index b - master holidays  
location\_id  
holiday date

expectation  
id  
location\_id  
name  
date\_report  
holiday date

when you want to use holiday date on kibana use top hit the result is  
The data you are seeing might be incomplete or wrong  
when or empty data

---

<div class="post-metadata">

### Author: ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)
#### Post date: [December 23, 2021, 2:11am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/6 "2021-12-23T02:11:36Z")

</div>

You cannot do that in Elasticsearch without reindexing into a new index that contains all that information, as @Divyank_Mahalle mentioned.

---

<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: [January 20, 2022, 2:12am UTC](https://discuss.elastic.co/t/how-to-join-two-index/292629/7 "2022-01-20T02:12:17Z")

</div>

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