# Combining two data sources into one or making a parent and child relation with two different sources

**URL:** https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089
**Category:** Elasticsearch
**Created:** [July 19, 2021, 3:45pm UTC](https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089 "2021-07-19T15:45:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![edster](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@edster](https://discuss.elastic.co/u/edster)
#### Post date: [July 19, 2021, 3:45pm UTC](https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089/1 "2021-07-19T15:45:30Z")

</div>

Hello,

So just to set some context around this. We are trying to work around the limitation of returning only at most 10k results during a search and with filters due to having an immense amount of data and it also coming from multiple indices.

Could I join multiple indices with different fields into one? Sounds like a mess but I figured I'd ask if it's possible.

The second idea is instead of using the child/parent join with the documents if it could be used with two indices. Is this also feasible or is there some other solution.

---

<div class="post-metadata">

### Author: ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)
#### Post date: [July 21, 2021, 2:16pm UTC](https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089/2 "2021-07-21T14:16:58Z")

</div>

Have you considered using [search\_after](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/paginate-search-results.html#search-after) and just running several requests using [Point in Time](https://www.elastic.co/guide/en/elasticsearch/reference/7.13/point-in-time.html)?

---

<div class="post-metadata">

### Author: ![edster](https://avatars.discourse-cdn.com/v4/letter/e/da6949/32.png) [@edster](https://discuss.elastic.co/u/edster)
#### Post date: [July 21, 2021, 7:05pm UTC](https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089/3 "2021-07-21T19:05:54Z")

</div>

So due to time constraints and current setup on our spring boot side we were siding with using the Reindex API in conjunction with the parent-child join, however, the parent child join is a bit confusing. As in using the join\_field or is that a said an actual field.

This is from an example I saw in a different post:  
if(ctx.\_source.parent\_id != null){ctx.\_routing = ctx.\_source.parent\_id; ctx.\_source.join\_field= params.cjoin}else{ctx.\_source.join\_field = params.parent\_join}",  
"params" : {  
"cjoin" :{  
"name": "child\_message",  
"parent": 1  
},  
"parent\_join" : "parent\_message"

}

---

<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: [August 18, 2021, 7:06pm UTC](https://discuss.elastic.co/t/combining-two-data-sources-into-one-or-making-a-parent-and-child-relation-with-two-different-sources/279089/4 "2021-08-18T19:06:03Z")

</div>

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