# Range based join between two indices?

**URL:** https://discuss.elastic.co/t/range-based-join-between-two-indices/379545
**Category:** Elasticsearch
**Tags:** reindex
**Created:** [June 26, 2025, 5:49pm UTC](https://discuss.elastic.co/t/range-based-join-between-two-indices/379545 "2025-06-26T17:49:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![echan23](https://avatars.discourse-cdn.com/v4/letter/e/ba8739/32.png) [@echan23](https://discuss.elastic.co/u/echan23)
#### Post date: [June 26, 2025, 5:49pm UTC](https://discuss.elastic.co/t/range-based-join-between-two-indices/379545/1 "2025-06-26T17:49:54Z")

</div>

I have two indices:

- IndexA with field Date\_time
- Index B with fields MoveInDateTime and MoveOutDateTime

I want to join them on MoveInDateTime \<= Date\_time \<= MoveOutDateTime.

Is this possible in Elasticsearch? If not, what are some alternative approaches?

Thank you very much!

---

<div class="post-metadata">

### Author: ![dadoonet](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dadoonet/32/137187_2.png) [@dadoonet](https://discuss.elastic.co/u/dadoonet)
#### Post date: [June 26, 2025, 6:11pm UTC](https://discuss.elastic.co/t/range-based-join-between-two-indices/379545/2 "2025-06-26T18:11:35Z")

</div>

Welcome!

I don't think you can do that. Even the new `LOOKUP JOIN` of ES|QL won't help with that.

An alternative approach would be by programmatically run:

- The search query on `IndexA`
- Iterate on all the results (up to 10000 - otherwise you need to use deep pagination)
- For each result, run a search query on `indexB`
- Join on the client side both informations...

My 2 cents
