# Multitype searching

**URL:** <https://discuss.elastic.co/t/multitype-searching/49205>\
**Category:** Elasticsearch\
**Created:** [May 4, 2016, 5:03pm UTC](https://discuss.elastic.co/t/multitype-searching/49205 "2016-05-04T17:03:17Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maher](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@maher](https://discuss.elastic.co/u/maher)\
**Post date:** [May 4, 2016, 5:03pm UTC](https://discuss.elastic.co/t/multitype-searching/49205/1 "2016-05-04T17:03:17Z")

</div>

Hi,  
I am trying to make a search on multitype idexe.  
-my index is "dashboard" wich contains 2 types :

```
     -"logs" that contains the data coming from logstash
     -"productPrices" that contains the data coming from Mysql database (documents contain "code", "p_price") 

```

So, i am trying to to make an aggregation on field "code" in the log type and a sub aggregation on the field "p\_price" wich is under the type "productPrices"

here the example :

localhost:9200/dashboard/\_search  
{  
"size":0,  
"aggs": {  
"products": {  
"terms": {  
"field": "code",  
},  
"aggs": {  
"prices": {  
"terms": {  
"field": "p\_price",  
"size": 3  
}  
}  
}  
}  
}  
}  
}

i get an empty result for the prices aggregation

Thank you,

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 5, 2016, 3:54am UTC](https://discuss.elastic.co/t/multitype-searching/49205/2 "2016-05-05T03:54:45Z")

</div>

This won't work because your first bucket based on the code won't have any documents with the price field.

---

<div class="post-metadata">

**Author:** ![maher](https://avatars.discourse-cdn.com/v4/letter/m/a6a055/32.png) [@maher](https://discuss.elastic.co/u/maher)\
**Post date:** [May 5, 2016, 5:27am UTC](https://discuss.elastic.co/t/multitype-searching/49205/3 "2016-05-05T05:27:23Z")

</div>

is there a way to get the documents code from the first type and search their price in the second type?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [May 5, 2016, 7:26am UTC](https://discuss.elastic.co/t/multitype-searching/49205/4 "2016-05-05T07:26:33Z")

</div>

No because that is like a join, which ES cannot do.

---

<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 5, 2017, 10:53pm UTC](https://discuss.elastic.co/t/multitype-searching/49205/5 "2017-07-05T22:53:50Z")

</div>


