# How to use JOIN operation in elasticsearch?

**URL:** <https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405>\
**Category:** Elasticsearch\
**Created:** [March 17, 2014, 1:32pm UTC](https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405 "2014-03-17T13:32:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nagarajan\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nagarajan_s/32/56148_2.png) [@Nagarajan\_S](https://discuss.elastic.co/u/Nagarajan_S)\
**Post date:** [March 17, 2014, 1:32pm UTC](https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405/1 "2014-03-17T13:32:16Z")

</div>

I have sql like

select s.name  
from Student s join Mark m  
on s.sid = m.sid  
where s.sid = 101

how can i replicate the same functionality in elastic search ?

Thanks and Regards,  
Nagarajan Sivaraman

--  
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/fb8cf0aa-70c1-4078-b500-0b1ac776d332%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/fb8cf0aa-70c1-4078-b500-0b1ac776d332%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Nagarajan\_S](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nagarajan_s/32/56148_2.png) [@Nagarajan\_S](https://discuss.elastic.co/u/Nagarajan_S)\
**Post date:** [March 17, 2014, 1:35pm UTC](https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405/2 "2014-03-17T13:35:10Z")

</div>

let the where condition is m.english = 91

On Monday, 17 March 2014 19:02:16 UTC+5:30, Nagarajan S wrote:

> I have sql like
> 
> select s.name  
> from Student s join Mark m  
> on s.sid = m.sid  
> where s.sid = 101
> 
> how can i replicate the same functionality in Elasticsearch ?
> 
> Thanks and Regards,  
> Nagarajan Sivaraman

--  
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/2ab36777-8965-46d4-b7de-ab4dc3ae3ea7%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/2ab36777-8965-46d4-b7de-ab4dc3ae3ea7%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![Binh\_Ly\_2](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@Binh\_Ly\_2](https://discuss.elastic.co/u/Binh_Ly_2)\
**Post date:** [March 17, 2014, 5:35pm UTC](https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405/3 "2014-03-17T17:35:04Z")

</div>

Unlike SQL, Elasticsearch does not support joins from 1 index to another.  
There is a notion of relationships in ES, but it's not exactly like SQL.  
Your best bet generally is to denormalize your tables (student, mark) and  
then use queries/filters for the where clause. If you still want to venture  
into the ES relationships capabilities, here is a good tutorial:

> **[Managing Relations Inside Elasticsearch
	  	 | Elastic](https://www.elastic.co/blog/managing-relations-inside-elasticsearch)**
>
> Data in the real world is rarely simple - often times it is a jumble of interlocking relations. How do you represent relational data in Elasticsearch? There are a few mechanisms that can be used to pr...

--  
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/15cff183-64c8-4bbc-b600-cd132d03c7ec%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/15cff183-64c8-4bbc-b600-cd132d03c7ec%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<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, 1:42am UTC](https://discuss.elastic.co/t/how-to-use-join-operation-in-elasticsearch/16405/4 "2017-07-06T01:42:45Z")

</div>


