Aggregations on Named Filters

I have just a general question for the group. Is it possible to perform an
aggregation on the matched_queries field array from a named filter? I
have the the query at the bottom that I would like to perform (I simplified
it here). I can have potentially a number of user defined queries that I
would like to aggregate on geohashes AND return the number of distinct
queries matched in each hash. For this example, the query would be for the
count of McDonalds and Starbucks but also if they both occur in the same
geohash. Right now, I'm doing it in two queries and performing the joins
in other code but I was looking for an ES only solution.

Thanks,
Ken

Query:
{
"aggs": {
"geohash": {
"geohash_grid": {
"field": "coordinates",
"precision": 3
},
"aggregations": {
"subcount": {
"": {
"field": "matched_queries"
}
}
}
}
},
"query": {
"filtered": {
"filter": {
"or": [
{
"fquery": {
"query": {
"query_string": {
"query": "McDonalds"
}
},
"_name": "McDonalds"
}
},
{
"fquery": {
"query": {
"query_string": {
"query": "Starbucks"
}
},
"_name": "Starbucks"
}
}
]
},
"query": {
"match_all": {}
}
}
},
"size": 100
}

Mock Response:
"geohash": {

  • "buckets": [
    • {
      • "key": "abc",
      • "doc_count": 2328,
      • "subcount": {
        • "buckets": [ 2 ]
          }
          },
    • {
      • "key": "abd",
      • "doc_count": 13,
      • "subcount": {
        • "buckets": [ 1 ]
          }
          }
    • ...

--
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 elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/570fd717-ddea-43c7-8078-5e0bc4f922a3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.