Is it bug or by design: if i group docs with option "&group.facet=true" then facet counts are grouped and "represent" groups, including the fact that no count can be larger than number of groups. But when the docs have nested docs and i additionally fetch neested docs facet with option "child.facet.field=some_field" then those facets are not grouped (they still relate to parent docs but not to "superparent" groups).
Example: 4 parent documents, each with 2 nested documents; parent documents will be grouped to 2 groups with 2 documents each. <update> <delete><query>*:*</query></delete> <add> <doc> <field name="group_id_s">1</field> <field name="id">11</field> <field name="doc_type_s">parentDoc</field> <field name="color_s">RED</field> <doc> <field name="id">111</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">L</field> </doc> <doc> <field name="id">112</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">L</field> </doc> </doc> <doc> <field name="group_id_s">1</field> <field name="id">12</field> <field name="doc_type_s">parentDoc</field> <field name="color_s">RED</field> <doc> <field name="id">121</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">L</field> </doc> <doc> <field name="id">122</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">XL</field> </doc> </doc> <doc> <field name="group_id_s">2</field> <field name="id">21</field> <field name="doc_type_s">parentDoc</field> <field name="color_s">RED</field> <doc> <field name="id">211</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">L</field> </doc> <doc> <field name="id">212</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">XXL</field> </doc> </doc> <doc> <field name="group_id_s">2</field> <field name="id">22</field> <field name="doc_type_s">parentDoc</field> <field name="color_s">BLUE</field> <doc> <field name="id">221</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">XL</field> </doc> <doc> <field name="id">222</field> <field name="doc_type_s">nestedDoc</field> <field name="size_s">XXL</field> </doc> </doc> </add> </update> Requests: 1. /bjqfacet?q={!parent which=doc_type_s:parentDoc}doc_type_s:nestedDoc&child.facet.field=size_s Returns 4 parent documents, nested facets reflect it: no count larger than 4 and for example size L count is only 3 since for the first parent doc it appeared in both nested docs, so for this parent doc it counts for 1. <lst name="size_s"> <int name="L">3</int> <int name="XL">2</int> <int name="XXL">2</int> </lst> 2. /bjqfacet?q={!parent which=doc_type_s:parentDoc}doc_type_s:nestedDoc&child.facet.field=size_s&facet=true&facet.field=color_s Adding color facet: <lst name="color_s"> <int name="RED">3</int> <int name="BLUE">1</int> </lst> <lst name="size_s"> <int name="L">3</int> <int name="XL">2</int> <int name="XXL">2</int> </lst> 3. /bjqfacet?q={!parent which=doc_type_s:parentDoc}doc_type_s:nestedDoc&child.facet.field=size_s&group=true&group.field=group_id_s&group.facet=true&facet=true&facet.field=color_s Adding grouping. Returns 2 groups. Color facets are grouped here reflecting groups. In a similar way in 1st request size facets changed to reflect parent documents, not nested documents. But here, after grouping, size facet counts do not change: they still reflect parent documents, not groups (for example size L count = 3 > number of groups = 2). <lst name="color_s"> <int name="RED">2</int> <int name="BLUE">1</int> </lst> <lst name="size_s"> <int name="L">3</int> <int name="XL">2</int> <int name="XXL">2</int> </lst> So is it bug or by design? If bug when it could be fixed? And how it can be fixed locally? I guess when grouping happens info about nested doc facets is already known and hence they can be grouped in a similar way like usual parent doc fields?