Filter on aggregation over nested docs

Suppose my data consists of businesses and users, who review the businesses
and stay in a particular state. Using the nested structure lets suppose we
store businesses with users as nested docs:
"name": "ABC"
"users": [
{"name": "Jack",
"state": "CA"
"name": "Jill",
"state": "NY"

I want to do a filter of the following nature:

List all businesses which have atleast 4 users from state: CA, which have
reviewed the business.

Ideally this is about putting a facet on top of nested docs and then using
this as a filter. How will that be done using current functionality of
ElasticSearch ?

Thanks in advance !

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
For more options, visit