Nested Filter & Nested Aggregation don't work together

Am I misunderstanding the Nested Filter? I expected it to exclude any
nested objects that didn't match it (and subsequently not match them in any
nested aggregations for the same path).

I have a field "foo" with a mapping type of "nested".

I execute a mach-all query with a Nested Terms Filter where the field
"" is "value1".
I also add a Nested terms aggregation on for the same field.

The problem is that the aggregation returns things other than "value1"!
It will return "value2" if other nested objects in the same document had

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit