# Filtering based on results of aggregations is not supported

**URL:** <https://discuss.elastic.co/t/filtering-based-on-results-of-aggregations-is-not-supported/158760>\
**Category:** Elasticsearch\
**Created:** [November 29, 2018, 12:43pm UTC](https://discuss.elastic.co/t/filtering-based-on-results-of-aggregations-is-not-supported/158760 "2018-11-29T12:43:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cezet](https://avatars.discourse-cdn.com/v4/letter/c/90db22/32.png) [@cezet](https://discuss.elastic.co/u/cezet)\
**Post date:** [November 29, 2018, 12:43pm UTC](https://discuss.elastic.co/t/filtering-based-on-results-of-aggregations-is-not-supported/158760/1 "2018-11-29T12:43:33Z")

</div>

Hi!

in 2014 there was a question regarding filtering over aggregation:

> [@Help with ES 1.x aggregation range filter over "sum" value](https://discuss.elastic.co/t/help-with-es-1-x-aggregation-range-filter-over-sum-value/17735):
>
> I have an index full of user transactions. credit is the amount of an individual transaction. To get a list of users with most total credits I have this working fine { "size": 0, // only interested in aggregation info "aggs": { "users": { "terms": { "field": "user\_id", "order": { "total\_sum.sum": "desc" } }, "aggs": { "total\_sum": { "sum": { "field": "credit" } } } } } } which is roughly equivalent in SQL: SELECT user\_id, SUM(credit) FROM index ORDER BY SUM(credit) DESC L…

the answer was: **Filtering based on results of aggregations is not supported unfortunately**

Whether filtreing based on results of aggregation possible now?

Thanks!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 27, 2018, 12:43pm UTC](https://discuss.elastic.co/t/filtering-based-on-results-of-aggregations-is-not-supported/158760/2 "2018-12-27T12:43:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
