# Search in two indexes

**URL:** <https://discuss.elastic.co/t/search-in-two-indexes/295506>\
**Category:** Elasticsearch\
**Created:** [January 26, 2022, 8:30pm UTC](https://discuss.elastic.co/t/search-in-two-indexes/295506 "2022-01-26T20:30:36Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)\
**Post date:** [January 27, 2022, 4:50am UTC](https://discuss.elastic.co/t/search-in-two-indexes/295506/3 "2022-01-27T04:50:00Z")

</div>

This transform approach could be another option, while there are some tradeoffs.

> [@How to join two index](https://discuss.elastic.co/t/how-to-join-two-index/274572/3):
>
> I like to add another option: [transform](https://www.elastic.co/guide/en/elasticsearch/reference/current/transforms.html). A transform in a nutshell is a task that runs aggregation queries and persists the result in an index. In order to join 2 indices you need compatible mappings for grouping, e.g. a key that is named the same way and has the same type. Note, this can be achieved with scripts or runtime fields, however if you want to run in it continuously at scale, it is advised to use proper ordinary mappings. For the group\_by use terms on the common key. For the aggreg…

---

_[View the full topic](https://discuss.elastic.co/t/search-in-two-indexes/295506)._
