elasticsearch/elasticsearch — pull request #5728 by martijnvg (2014-04-08 09:00:03+00:00)
Title: Nested `nested` aggregation don't respect its parent `nested` aggregation.

Every `nested` aggs uses the non nested docs filter as parent reference. This can lead to incorrect doc counts and other metrics.

This PR sets the proper parent docs for nested `nested` aggs, which depends on which is the closest parent nested aggs.