How to query data with parent and child documents


(Praveen) #1

I have indexed documents of two type One Parent doc will have many child docs. Child docs just contain key value pair. Parent doc has list of keys.

I would like to query where query matches the parent doc and we need to filter the docs based on the key for both parent and child. Applying filter will return only one child doc so I can use that for filtering. Child doc values are used in score function for ranking purpose.

Can someone suggest how to do this ?


(Thiago Souza) #2

For matching both parent and child you could query on parent using a bool query to combine the query on the parent and a Has Child query.


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.