Re: Aggregating on nested fields

2014-11-12 Thread Ivan Brusic
I beg to differ, aggregations work with the root documents returned by query, so they do not work under a global context. :) I guess under my proposed vision the issue would be then how to have aggregations on documents returned with a nested filter, but still maintain all the nested documents. A

Re: Aggregating on nested fields

2014-11-11 Thread Ivan Brusic
I suddenly remembered when using facets that I had to apply the same query filter as a facet filter with the join option disabled. Turns out it is somewhat identical with aggregations. My problem was that the scope of my nested aggregation with not under the scope of the filter aggregation. I hope

Re: Aggregating on nested fields

2014-11-11 Thread Adrien Grand
Hi Ivan, You indeed ned to repeat the filter under a nested aggregation to make it work. If we ever allow queries to return nested documents, I agree that filters should not be repeated under aggs, but since now queries only return the root documents, I think it is actually consistent to return

Re: Aggregating on nested fields

2014-11-10 Thread Ivan Brusic
Reproducible gist: https://gist.github.com/brusic/81e1552ffd49a1f6a7aa Surely I cannot be the only one to have encountered this issue. -- Ivan On Mon, Nov 10, 2014 at 12:53 PM, Ivan Brusic i...@brusic.com wrote: Is it possible to aggregate only on the nested documents that are returned by a