Hi,

Let's say I have an index with multiple documents in it. Documents could have a field called "points" that is a list of objects. For example, say I have 2 documents in my_index

my_index/type/doc1: "points": [{"x": 3, "y":2}, {"x": -4, "y": 17}, {"x": 9, "y": 8}].

my_index/type/doc2: "points": [{"x": 10, "y":8}, {"x": 7, "y": 4}, {"x": -12, "y": 17}]

I would like to preserve the relation between x and y in each object so I use a nested type. What I want to do is be able to do is a 2-dimensional histogram: so given xInterval and a yInterval find the count of all points in a buckets of size xInterval by yInterval.

There is no 2 dimensional histogram supported by ES as far as I know, so I wanted to do a filter on the points, and then do an aggregation (So I could filter all the points where points.x is in range [x1, x2) and points.y is in range [y1, y2] and then give me the count. Or I could get all points where points.x is in range [x1, x2) and then do a one dimensional histogram aggregation on points.y with interval yInterval).

So long story short: is there a way to do a filter on a nested type, and then do aggregation on those nested documents? Right now, I get the whole document and not just the nested documents which throws off my aggregation.

Thanks!