# Join between two indices is possible in elasticsearch

**URL:** https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170
**Category:** Elasticsearch
**Created:** [December 17, 2019, 1:44pm UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170 "2019-12-17T13:44:31Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Amit\_Chauhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit_chauhan/32/45644_2.png) [@Amit\_Chauhan](https://discuss.elastic.co/u/Amit_Chauhan)
#### Post date: [December 17, 2019, 1:44pm UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/1 "2019-12-17T13:44:32Z")

</div>

I want to perform join between two indecis in elasticsearch.

---

<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 17, 2019, 4:02pm UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/2 "2019-12-17T16:02:30Z")

</div>

Elasticsearch does not support joins. If you can describe your data and the type of queries you need to support someone might be able to suggest workarounds though.

---

<div class="post-metadata">

### Author: ![val](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/val/32/138203_2.png) [@val](https://discuss.elastic.co/u/val)
#### Post date: [December 17, 2019, 4:07pm UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/3 "2019-12-17T16:07:35Z")

</div>

As a possible workaround, you might be interested to check [this other discussion](https://discuss.elastic.co/t/enrich-documents-by-copying-fields-from-another-index/170882/8) and also [this article about the new enrich processor](https://www.elastic.co/blog/introducing-the-enrich-processor-for-elasticsearch-ingest-nodes) available in ES 7.5.

---

<div class="post-metadata">

### Author: ![Hendrik\_Muhs](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hendrik_muhs/32/25802_2.png) [@Hendrik\_Muhs](https://discuss.elastic.co/u/Hendrik_Muhs)
#### Post date: [December 17, 2019, 4:34pm UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/4 "2019-12-17T16:34:50Z")

</div>

in addition to the already given answers, I like to mention another possibility: You could "join" 2 indices using [transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html) and create a new index which has the data of both. Scripting give you a lot of flexibility to do this.

2 related posts:

> [@Is is possible to partially update a dest doc with transforms?](https://discuss.elastic.co/t/is-is-possible-to-partially-update-a-dest-doc-with-transforms/209808/4):
>
> Hi, a transform can have multiple sources and they do not need a common schema as long as the field name of the group\_by is compatible. So if you have for example a field "customer\_id" in both indices "past\_purchases" and "predicted\_purchases" you can create a transform that joins over both indices: PUT \_transform/prediction\_accuracy { "source": { "index": ["past\_purchases", "predicted\_purchases"] }, "pivot": { "group\_by": { "id": {"terms": { "field": "customer\_id" …

> [@How to aggregate data on elastic sent by logstash](https://discuss.elastic.co/t/how-to-aggregate-data-on-elastic-sent-by-logstash/205140/2):
>
> Hi, you should be able to do this using transform (see [https://www.elastic.co/guide/en/elasticsearch/reference/7.4/put-transform.html](https://www.elastic.co/guide/en/elasticsearch/reference/7.4/put-transform.html)). The workflow would look like this: you index the data into elasticsearch as single docs, this is the "source" index you create a transform that pulls data from the "source" and aggregates it according to your needs into a "dest" index. In your case you would group by entity Id, firm id, etc. and define aggregations, e.g. lastUpdated would be a max aggregatio…

`It depends` on what you want to do. We do not have the classical database `join` but we might be able to solve you usecase in a different way.

Maybe you can describe what you want to do?

---

<div class="post-metadata">

### Author: ![Amit\_Chauhan](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/amit_chauhan/32/45644_2.png) [@Amit\_Chauhan](https://discuss.elastic.co/u/Amit_Chauhan)
#### Post date: [December 19, 2019, 11:29am UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/5 "2019-12-19T11:29:39Z")

</div>

Thanks to all for your valuable suggestions. yours answer helps a lot to me. Now we are facing another problem..  
Can you please let me know if we can integrate the Kibana in our application in such a way that 1 dashboard is accessed by multiple users but each users can see different different dashboard based on their access of data.

---

<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 16, 2020, 11:29am UTC](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170/6 "2020-01-16T11:29:47Z")

</div>

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