>From the reference guide: group.ngroups and group.facet require that all documents in each group must be co-located on the same shard in order for accurate counts to be returned. Document routing via composite keys can be a useful solution in many situations.
It's not clear what you think the prolbem here is. You say: bq: Ex: Below response contains 5 groups (Which is correct) but ngroups is 11. But you have rows set to 5 so? As far as your sorting issue, again an example showing what you think is wrong would be very helpful. Best, Erick On Wed, Jul 8, 2015 at 6:38 AM, Pankaj Sonawane <pankaj4sonaw...@gmail.com> wrote: > Hi, > > I am using sharding (3 shards) with Zookeeper. > > When I query a collection using " > *group=true&group.field=NAME&group.ngroups=true*" parameters, "*ngroups*" in > response is incorrect. However I am getting correct count in doclist array. > > Ex: Below response contains 5 groups (Which is correct) but ngroups is 11. > > { > "responseHeader":{ > "status":0, > "QTime":49, > "params":{ > "group.ngroups":"true", > "indent":"true", > "start":"0", > "q":"*:*", > "group.field":"NAME", > "group":"true", > "wt":"json", > "rows":"5" > } > }, > "grouped":{ > "NAME":{ > "matches":18, > "ngroups":11, > "groups":[ > { > "groupValue":"A-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "maxScore":1, > "docs":[ > { > "NAME":"A-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"B-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "docs":[ > { > "NAME":"B-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"C-SERIES", > "doclist":{ > "numFound":1, > "start":0, > "docs":[ > { > "NAME":"C-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"D-SERIES", > "doclist":{ > "numFound":5, > "start":0, > "docs":[ > { > "NAME":"D-SERIES", > "_version_":1505559209034383400 > } > ] > } > }, > { > "groupValue":"E-SERIES", > "doclist":{ > "numFound":3, > "start":0, > "maxScore":1, > "docs":[ > { > "NAME":"E-SERIES", > "_version_":1505559209034383400 > } > ] > } > } > ] > } > } > } > > I am facing same problem with Recip function to get latest record on some > date field when using sharding. It returns back records in wrong order. > > Note: Same configuration works fine on single machine without sharding. > > Please Help me to find solution. > > Thanks.