How to query data with parent and child documents

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 ?

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.

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