# Query join cross types

**URL:** <https://discuss.elastic.co/t/query-join-cross-types/17748>\
**Category:** Elasticsearch\
**Created:** [May 27, 2014, 10:13am UTC](https://discuss.elastic.co/t/query-join-cross-types/17748 "2014-05-27T10:13:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Petr\_Jansky](https://avatars.discourse-cdn.com/v4/letter/p/ec9cab/32.png) [@Petr\_Jansky](https://discuss.elastic.co/u/Petr_Jansky)\
**Post date:** [May 27, 2014, 10:13am UTC](https://discuss.elastic.co/t/query-join-cross-types/17748/1 "2014-05-27T10:13:44Z")

</div>

Hello guys,

I'm trying to find a way how to solve this case with two types:

"product" : {  
"properties" : {  
"kbi\_id" : { "type" : "string", "index" : "not\_analyzed"},  
"agreement\_status" : { "type" : "string", "index" :  
"not\_analyzed"}, _- values Y/N_  
"product\_code" : { "type" : "string", "index" : "not\_analyzed"},  
"date\_valid" : { "type" : "string", format : "dd.MM.yyyy"}  
}}  
~120M records

"note" : {  
"properties" : {  
"note" : { "type" : "string", "analyzer" : "cestina\_hunspell"},  
"kbi\_id" : { "type" : "string", "index" : "not\_analyzed"},  
"created\_date" : {"type" : "date", format : "dd.MM.yyyy HH:mm:ss"},  
}},  
~3M records

The kbi\_id field is clientID - join field. I don't have clients in my index.

I would like to get all note records for witch exist 1+ product record with  
agreement\_status="Y" and simultaneously 1+ product record with  
agreement\_status="N".

Any ideas?

Thx  
Petr

--  
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/4b217624-f542-4f7d-8493-fc7a93932e65%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/4b217624-f542-4f7d-8493-fc7a93932e65%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:26am UTC](https://discuss.elastic.co/t/query-join-cross-types/17748/2 "2017-07-06T01:26:45Z")

</div>


