Hi hpotla, Use a Solr sub-query. https://nightlies.apache.org/solr/draft-guides/solr-reference-guide-main/transforming-result-documents.html#subquery
~ David Smiley Apache Lucene/Solr Search Developer http://www.linkedin.com/in/davidwsmiley On Wed, May 19, 2021 at 12:31 PM Hima Bindu <[email protected]> wrote: > Hi, > > I have a requirement to group my results based on a field in child > document. > Eg: In below documents, I need to group based on field “title” in child > documents. > My results should have list of parent documents and each parent document > should have child documents grouped by their title. > I didn’t find a way to group child documents in solr documentation. Can > any one help me with a solution for this? > > [ > > { > "ID": “1", > "title": “new customers", > "content_type": "parentDocument", > "_childDocuments_": [ > > { > > "ID": “2”, > > “t*itle"*: “MD”, > > "comments": "Lots of new services”, > > "_nest_parent_”:”1" > > } { > > "ID": “3”, > > “t*itle"*: “OD”, > > "comments": "Lots of new patients”, > > "_nest_parent_”:”1" > > } > > ] > } > > { > "ID": “4", > "title": “new customers", > "content_type": "parentDocument", > "_childDocuments_": [ > > { > > "ID": “5”, > > “t*itle"*: “MD”, > > "comments": "Lots of new services”, > > "_nest_parent_”:”4” > > } { > > "ID": “6”, > > “t*itle"*: “OD”, > > "comments": "Lots of new patients”, > > "_nest_parent_”:”4" > > } > > ] > } > > > ] > > > > Appreciate your help in advance! > > Thanks, > hpotla >
