# How to create relationship between two indices

**URL:** <https://discuss.elastic.co/t/how-to-create-relationship-between-two-indices/152782>\
**Category:** Elasticsearch\
**Created:** [October 17, 2018, 8:43am UTC](https://discuss.elastic.co/t/how-to-create-relationship-between-two-indices/152782 "2018-10-17T08:43:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dhaval.kathiriya](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dhaval.kathiriya](https://discuss.elastic.co/u/dhaval.kathiriya)\
**Post date:** [October 17, 2018, 8:43am UTC](https://discuss.elastic.co/t/how-to-create-relationship-between-two-indices/152782/1 "2018-10-17T08:43:32Z")

</div>

I Have two indices

1. read\_format
2. device\_status\_format

now i want to join data of that two indices

data format of read\_format

"hits": [  
{  
"\_index": "read\_format",  
"\_type": "doc",  
"\_id": "9FmifGYBii-5lA4ewFu3",  
"\_score": 1,  
"\_source": {  
"WMPower": 30,  
"CommMode": "Wireless",  
"WUName": "Jalef",  
"tags": [  
"beats\_input\_raw\_event"  
],  
"CTNo": "264",  
"WMExpon": "LL",  
"WUNo": "32698",  
"WMValve": 100,  
"ReadTime": "13:25:12",  
"offset": 426,  
"host": {  
"name": "EQUEST025"  
},  
"type": "read\_format",  
"@timestamp": "2018-10-16T11:28:51.489Z",  
"fields": {  
"log\_type": "read\_format"  
},  
"source": """D:\logs\read\_format.json""",  
"ReadDate": "2018-10-16",  
"beat": {  
"version": "6.4.2",  
"hostname": "EQUEST025",  
"name": "EQUEST025"  
},  
"@version": "1",  
"CENo": "1392658740",  
"WMCode": "359647012",  
"ElecAttacks": "0"  
}  
}  
]

data format of device\_status\_format

"hits": [  
{  
"\_index": "device\_status\_format",  
"\_type": "doc",  
"\_id": "ukFMgGYBuf46FDrIVau1",  
"\_score": 1,  
"\_source": {  
"CENo": "1392658740",  
"offset": 1561,  
"ReadTime": "14:48:08",  
"source": """D:\logs\device\_status\_format.json""",  
"tags": [  
"beats\_input\_raw\_event"  
],  
"type": "device\_status\_format",  
"UnusualAmount": "165",  
"beat": {  
"name": "EQUEST025",  
"version": "6.4.2",  
"hostname": "EQUEST025"  
},  
"fields": {  
"log\_type": "device\_status\_format"  
},  
"ReadDate": "2018-10-16",  
"CEState": "Offline",  
"@version": "1",  
"WUName": "Ctelj",  
"ReadAmount": "32",  
"WUNo": "54702",  
"CEType": "Wired table concentrator",  
"@timestamp": "2018-10-17T04:32:56.945Z",  
"host": {  
"name": "EQUEST025"  
}  
}  
},  
{  
"\_index": "device\_status\_format",  
"\_type": "doc",  
"\_id": "\_Fm9fGYBii-5lA4e2VtP",  
"\_score": 1,  
"\_source": {  
"UnusualAmount": "891",  
"tags": [  
"beats\_input\_raw\_event"  
],  
"CEState": "Offline",  
"ReadAmount": "25",  
"WUNo": "80765",  
"offset": 975,  
"ReadTime": "13:48:20",  
"host": {  
"name": "EQUEST025"  
},  
"type": "device\_status\_format",  
"@timestamp": "2018-10-16T11:58:26.571Z",  
"fields": {  
"log\_type": "device\_status\_format"  
},  
"source": """D:\logs\device\_status\_format.json""",  
"ReadDate": "2018-10-16",  
"beat": {  
"version": "6.4.2",  
"name": "EQUEST025",  
"hostname": "EQUEST025"  
},  
"CEType": "Wired table concentrator",  
"@version": "1",  
"CENo": "1392658740",  
"WUName": "Hbckw"  
}  
}  
]

- now i want to join on CENo fileds and getting matching records.

---

<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:** [November 14, 2018, 8:43am UTC](https://discuss.elastic.co/t/how-to-create-relationship-between-two-indices/152782/2 "2018-11-14T08:43:32Z")

</div>

Closed on November 14, 2018, 8:43am UTC

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