# How to fetch the joined records from two indexes

**URL:** <https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373>\
**Category:** OpenSearch\
**Tags:** troubleshoot\
**Created:** [March 14, 2024, 1:20pm UTC](https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373 "2024-03-14T13:20:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ganeshsanpada](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@ganeshsanpada](https://forum.opensearch.org/u/ganeshsanpada)\
**Post date:** [March 14, 2024, 1:20pm UTC](https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373/1 "2024-03-14T13:20:08Z")

</div>

**Versions** (relevant - OpenSearch/Dashboard/Server OS/Browser):

“name” : “271d4455010d”,  
“cluster\_name” : “docker-cluster”,  
“cluster\_uuid” : “Ma7ZWd5mTHe9NbPVYjVTcw”,  
“version” : {  
“distribution” : “opensearch”,  
“number” : “2.12.0”,  
“build\_type” : “tar”,  
“build\_hash” : “2c355ce1a427e4a528778d4054436b5c4b756221”,  
“build\_date” : “2024-02-20T02:20:12.084014282Z”,  
“build\_snapshot” : false,  
“lucene\_version” : “9.9.2”,  
“minimum\_wire\_compatibility\_version” : “7.10.0”,  
“minimum\_index\_compatibility\_version” : “7.0.0”  
}

@opensearch @opensearch_user100

**Describe the issue** :

Hello Team,

I Have two indices and I want to fetch the data from both the indices using some conditions and I want to do filter as well.

Please provide the solution I have checked everywhere but i could not found anything.

Note: I don’t want nested object , instead of it I want two separated index and want to get the joined data based on some conditions.

**Configuration** :

I have deployed using helm chart for that I have used opensearchproject/opensearch:latest  
image

**Relevant Logs or Screenshots** :

---

<div class="post-metadata">

**Author:** ![Mantas](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Mantas](https://forum.opensearch.org/u/Mantas)\
**Post date:** [March 14, 2024, 2:23pm UTC](https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373/2 "2024-03-14T14:23:46Z")

</div>

Hi @ganeshsanpada,

Have you checked if `_msearch` suits your use case?

Please see more here:

> **[Multi-search](https://opensearch.org/docs/1.2/opensearch/rest-api/multi-search/)**
>
> Multi-search Introduced 1.0

Best,  
mj

---

<div class="post-metadata">

**Author:** ![ganeshsanpada](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@ganeshsanpada](https://forum.opensearch.org/u/ganeshsanpada)\
**Post date:** [March 15, 2024, 5:27am UTC](https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373/3 "2024-03-15T05:27:11Z")

</div>

Hello @Mantas ,

Thanks for your update but my use case is just like mysql joins because I want to get the filtered data from the multiple index based on some join conditions like mysql  
and my work is to update those data independently , I have tried to used the nested index but it seems it’s taking to much time when concurrent modification is happened because I have huge amount of data .

---

<div class="post-metadata">

**Author:** ![Mantas](https://avatars.discourse-cdn.com/v4/letter/m/7bcc69/32.png) [@Mantas](https://forum.opensearch.org/u/Mantas)\
**Post date:** [March 15, 2024, 10:59am UTC](https://forum.opensearch.org/t/how-to-fetch-the-joined-records-from-two-indexes/18373/4 "2024-03-15T10:59:24Z")

</div>

Hi @ganeshsanpada,

You could simply run something like:

```auto
GET index01,index02/_search
{
  "query": {
    "match_all": {}
  }
}

```

You might as well be interested in checking out aliases depending on the use case:

> **[Index aliases](https://opensearch.org/docs/latest/im-plugin/index-alias/)**
>
> Index aliases

Best,  
mj
