Nested aggregations not bringing any result


I'm working on an algorithm that will generate an Elasticsearch query. In this algorithm nested aggregations may be produced.
In some cases, the nested aggregations does not produce any results.

Here's the sample mapping and data:

My algorithm is generating the following query:

The result is the following:

But I really think it should be something like:

The sub2_nested aggregation has 0 documents, but I think it should have 2 documents (t1 and t2).
If I manually remove the sub2_nested aggregation (moving sub2 aggregation up) I can have the desired result.

The question is: does a nested aggregation mess up with another one?


(system) #2