# 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:** 1\
**Showing post:** 4

<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?

---

_[View the full topic](https://discuss.elastic.co/t/join-between-two-indices-is-possible-in-elasticsearch/212170)._
