# Join like functionality for searching b/w multiple docs

**URL:** https://discuss.elastic.co/t/join-like-functionality-for-searching-b-w-multiple-docs/11492
**Category:** Elasticsearch
**Created:** [April 8, 2013, 8:33pm UTC](https://discuss.elastic.co/t/join-like-functionality-for-searching-b-w-multiple-docs/11492 "2013-04-08T20:33:15Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discuss.elastic.co/u/shadyabhi)
#### Post date: [April 8, 2013, 8:33pm UTC](https://discuss.elastic.co/t/join-like-functionality-for-searching-b-w-multiple-docs/11492/1 "2013-04-08T20:33:15Z")

</div>

Hi all,

I'm not even sure if it's possible in ES and I think it isn't but still  
here it goes.

Lets suppose I've two docs A and B.

Doc A: Has fields A and X.  
Doc B: Has fields B and X.

X is the field that has same value in both the docs.

Problem statement is, I only know A and have to get B with the help of X  
(which is same for both docs)

Is that possible in Elasticsearch in one query or do I've to write two  
queries?

--  
Regards,  
Abhijeet Rastogi (shadyabhi)

> **[Abhijeet's Blog](https://blog.abhijeetr.com/)**
>
> I write about problems that I solve

--  
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: ![Clinton\_Gormley](https://avatars.discourse-cdn.com/v4/letter/c/50afbb/32.png) [@Clinton\_Gormley](https://discuss.elastic.co/u/Clinton_Gormley)
#### Post date: [April 9, 2013, 12:11pm UTC](https://discuss.elastic.co/t/join-like-functionality-for-searching-b-w-multiple-docs/11492/2 "2013-04-09T12:11:44Z")

</div>

> Problem statement is, I only know A and have to get B with the help of  
> X (which is same for both docs)
> 
> Is that possible in Elasticsearch in one query or do I've to write two  
> queries?

You have to write two queries

clint

--  
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: ![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:42am UTC](https://discuss.elastic.co/t/join-like-functionality-for-searching-b-w-multiple-docs/11492/3 "2017-07-06T02:42:04Z")

</div>


