# Cross-index parent/child support?

**URL:** <https://discuss.elastic.co/t/cross-index-parent-child-support/6593>\
**Category:** Elasticsearch\
**Created:** [February 4, 2012, 11:50am UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593 "2012-02-04T11:50:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg](https://avatars.discourse-cdn.com/v4/letter/g/71c47a/32.png) [@Greg](https://discuss.elastic.co/u/Greg)\
**Post date:** [February 4, 2012, 11:50am UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/1 "2012-02-04T11:50:19Z")

</div>

Hi all

Does Elasticsearch support mapping a child to a parent in a different  
index?

Thanks  
Greg

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [February 5, 2012, 4:31pm UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/2 "2012-02-05T16:31:46Z")

</div>

No...

On Saturday, February 4, 2012 at 1:50 PM, Greg wrote:

> Hi all
> 
> Does Elasticsearch support mapping a child to a parent in a different  
> index?
> 
> Thanks  
> Greg

---

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [November 26, 2013, 10:18am UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/3 "2013-11-26T10:18:42Z")

</div>

Hi,

I'm bringing this question back into surface and I wanted just to ask  
whether such a functionality is planned or thought to be supported in the  
future. The thing is that it would be very useful in the case that we need  
to support (at least one way) analytics for uniqueness. Actually is there a  
way to do it with the Lookup functionality?

Thanks

On Saturday, 4 February 2012 13:50:19 UTC+2, Greg wrote:

> Hi all
> 
> Does Elasticsearch support mapping a child to a parent in a different  
> index?
> 
> Thanks  
> Greg

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![mattweber](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mattweber/32/44940_2.png) [@mattweber](https://discuss.elastic.co/u/mattweber)\
**Post date:** [November 26, 2013, 5:04pm UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/4 "2013-11-26T17:04:33Z")

</div>

Hi Thomas,

Yes, soon.

> <https://github.com/elastic/elasticsearch/pull/3278>
>
> This PR adds support for generating a terms filter based on the field values
> of …documents matching a specified lookup query/filter. The value of the 
> configurable "path" field is collected from the field data cache for each 
> document matching the lookup query/filter and is then used to filter the main 
> query. This is can also be called a join filter.
> 
> This PR abstracts the TermsLookup functionality in order to support multiple
> lookup methods. The existing functionality is moved into FieldTermsLookup and
> the new query based lookup is in QueryTermsLookup. All existing caching 
> functionality works with the new query based lookup for increased performance.
> 
> During testing of I found that one of the performance bottlenecks was 
> generating the Lucene TermsFilter on large sets of terms (probably since
> it sorts the terms). I have created a FieldDataTermsFilter that uses the
> field data cache to lookup value of the field being filtered and compare it to
> the set of gathered terms. This significantly increased performance at the 
> cost of higher memory usage. Currently a TermsFilter is used when the number
> of filtering terms is less than 1024 and the FieldDataTermsFilter is used
> for everything else. This should eventually be configurable or we need to
> perform some test to find the optimal value.
> 
> Examples:
> 
> Replicate a has\_child query by joining on the child's "pid" field to the
> parent's "id" field for each child that has the tag "something".
> 
> \`\`\`
> curl -XPOST 'http://localhost:9200/parentIndex/\_search' -d '{
> "query": {
> "constant\_score": {
> "filter": {
> "terms": {
> "id": {
> "index": "childIndex",
> "type": "childType",
> "path": "pid",
> "query": {
> "term": {
> "tag": "something"
> }
> }
> }
> }
> }
> }
> }
> }'
> \`\`\`
> 
> Lookup companies that offer products or services mentioning elasticsearch.
> Notice that products and services are kept in their own indices.
> 
> \`\`\`
> curl -XPOST 'http://localhost:9200/companies/\_search' -d '{
> "query": {
> "constant\_score": {
> "filter": {
> "terms": {
> "company\_id": {
> "indices": \["products", "services"\],
> "path": "company\_id",
> "filter": {
> "term": {
> "description": "elasticsearch"
> }
> }
> }
> }
> }
> }
> }
> }'
> \`\`\`

Thanks,  
Matt Weber

On Tue, Nov 26, 2013 at 2:18 AM, Thomas [thomas.bolis@gmail.com](mailto:thomas.bolis@gmail.com) wrote:

> Hi,
> 
> I'm bringing this question back into surface and I wanted just to ask  
> whether such a functionality is planned or thought to be supported in the  
> future. The thing is that it would be very useful in the case that we need  
> to support (at least one way) analytics for uniqueness. Actually is there a  
> way to do it with the Lookup functionality?
> 
> Thanks
> 
> On Saturday, 4 February 2012 13:50:19 UTC+2, Greg wrote:
> 
> > Hi all
> > 
> > Does Elasticsearch support mapping a child to a parent in a different  
> > index?
> > 
> > Thanks  
> > Greg
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoBA\_vmz9jjmy-xg%2B0-%3Ds6mcVkVb\_x2fY%2BC6cbt0OVSZ2g%40mail.gmail.com](https://groups.google.com/d/msgid/elasticsearch/CAJ3KEoBA_vmz9jjmy-xg%2B0-%3Ds6mcVkVb_x2fY%2BC6cbt0OVSZ2g%40mail.gmail.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![Thomas\_Bolis](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/thomas_bolis/32/700_2.png) [@Thomas\_Bolis](https://discuss.elastic.co/u/Thomas_Bolis)\
**Post date:** [November 27, 2013, 8:20am UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/5 "2013-11-27T08:20:43Z")

</div>

Great news,

Thank you Matt

On Tuesday, 26 November 2013 19:04:33 UTC+2, Matt Weber wrote:

> Hi Thomas,
> 
> Yes, soon.
> 
> [Terms Lookup by Query/Filter (aka. Join Filter) by mattweber · Pull Request #3278 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/pull/3278)
> 
> Thanks,  
> Matt Weber
> 
> On Tue, Nov 26, 2013 at 2:18 AM, Thomas \<[thomas...@gmail.com](mailto:thomas...@gmail.com) \<javascript:\>
> 
> > wrote:
> 
> > Hi,
> > 
> > I'm bringing this question back into surface and I wanted just to ask  
> > whether such a functionality is planned or thought to be supported in the  
> > future. The thing is that it would be very useful in the case that we need  
> > to support (at least one way) analytics for uniqueness. Actually is there a  
> > way to do it with the Lookup functionality?
> > 
> > Thanks
> > 
> > On Saturday, 4 February 2012 13:50:19 UTC+2, Greg wrote:
> > 
> > > Hi all
> > > 
> > > Does Elasticsearch support mapping a child to a parent in a different  
> > > index?
> > > 
> > > Thanks  
> > > Greg
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/5ed27f47-72d0-4530-a537-27d745053101%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/5ed27f47-72d0-4530-a537-27d745053101%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 2:04am UTC](https://discuss.elastic.co/t/cross-index-parent-child-support/6593/6 "2017-07-06T02:04:39Z")

</div>


