Elasticsearch get all parents and children

Viewed 236

I have an Elastic Search mapping with parent and child documents. It can be one-to-many but I have only created one-to-one relationship between a parent and child. Reason for this relationship instead of nested documents is that children are updated frequently and I can avoid touching parent documents everytime. This would avoid creating deleted documents of parent doc type which is taking 70% more space than required before merge happens.

Now I have a query which returns a list of parent documents. But I also want to retrieve all children for that parent list.

Is it possible to get all parents and associated children with the same query instead of running a separate query to get children of each parent?

0 Answers
Related