Count number for nested array objects


I was wondering if there's a way return count based on the number of nested
array items, instead of Document count.


So if I have something like this:

obj : {
array : [{
id: 1,
group: A
id: 2,
group: A
id: 3,
group: B

And I want to count number of items with group=A, it should return 2,
instead of 1 (the Doc count)

Is there a way of doing this?


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