# Nested Documents: ToChildBlockJoinQuery, TopGroups

**URL:** <https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947>\
**Category:** Elasticsearch\
**Created:** [September 6, 2012, 3:05pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947 "2012-09-06T15:05:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 6, 2012, 3:05pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/1 "2012-09-06T15:05:18Z")

</div>

Hi,

would it be possible to expose query on top of ToChildBlockJoinQuery?  
Also the TopGroups from ToParentBlockJoinQueryCollector sounds very  
interesting and I am sure this would be nice addition.

It would probably require change in response format, is there any other  
reason why it would be not good idea to expose it? (Performance?)

Regards,  
Lukas

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [September 10, 2012, 1:01pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/2 "2012-09-10T13:01:30Z")

</div>

> would it be possible to expose query on top of ToChildBlockJoinQuery?  
> At the moment the nested query is using the BlockJoinQuery (a 95% copy  
> of the ToChildBlockJoinQuery)

> Also the TopGroups from ToParentBlockJoinQueryCollector sounds very  
> interesting and I am sure this would be nice addition.  
> Agree, this would be a very nice addition.

> It would probably require change in response format, is there any other  
> reason why it would be not good idea to expose it? (Performance?)  
> I don't see any performance reasons why something like this couldn't  
> be added. Block joins are cheap. Representing this in the api and the  
> response needs some careful thinking. I think it is similar to result  
> grouping.

--

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 12, 2012, 8:48pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/3 "2012-09-12T20:48:45Z")

</div>

Ah, I see. I thought it was using directly what is in Lucene 3.1.6 now.  
Out of curiosity, what is the reason Lucene classes can not be used  
directly?

Lukas

On Mon, Sep 10, 2012 at 3:01 PM, Martijn v Groningen \<  
[martijn.v.groningen@gmail.com](mailto:martijn.v.groningen@gmail.com)\> wrote:

> > would it be possible to expose query on top of ToChildBlockJoinQuery?  
> > At the moment the nested query is using the BlockJoinQuery (a 95% copy  
> > of the ToChildBlockJoinQuery)
> 
> > Also the TopGroups from ToParentBlockJoinQueryCollector sounds very  
> > interesting and I am sure this would be nice addition.  
> > Agree, this would be a very nice addition.
> 
> > It would probably require change in response format, is there any other  
> > reason why it would be not good idea to expose it? (Performance?)  
> > I don't see any performance reasons why something like this couldn't  
> > be added. Block joins are cheap. Representing this in the api and the  
> > response needs some careful thinking. I think it is similar to result  
> > grouping.
> 
> --

--

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [September 13, 2012, 12:33pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/4 "2012-09-13T12:33:21Z")

</div>

> Out of curiosity, what is the reason Lucene classes can not be used  
> directly?  
> The BlockJoinQuery has been modified to support facets in the nested  
> queries scope.

Martijn

--

---

<div class="post-metadata">

**Author:** ![Lukas\_Vlcek1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas_vlcek1/32/819_2.png) [@Lukas\_Vlcek1](https://discuss.elastic.co/u/Lukas_Vlcek1)\
**Post date:** [September 13, 2012, 1:22pm UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/5 "2012-09-13T13:22:34Z")

</div>

Ah! Good to know.

The reason why I am asking is primarily because when explaining Nested  
Documents to users one could point them to Lucene documentation which is  
very useful. So in this case it is good to know what is the difference.

Thanks,  
Lukas

On Thu, Sep 13, 2012 at 2:33 PM, Martijn v Groningen \<  
[martijn.v.groningen@gmail.com](mailto:martijn.v.groningen@gmail.com)\> wrote:

> > Out of curiosity, what is the reason Lucene classes can not be used  
> > directly?  
> > The BlockJoinQuery has been modified to support facets in the nested  
> > queries scope.
> 
> Martijn
> 
> --

--

---

<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, 3:12am UTC](https://discuss.elastic.co/t/nested-documents-tochildblockjoinquery-topgroups/8947/6 "2017-07-06T03:12:53Z")

</div>


