# Can Mvel access a set of documents from a query?

**URL:** <https://discuss.elastic.co/t/can-mvel-access-a-set-of-documents-from-a-query/16107>\
**Category:** Elasticsearch\
**Created:** [March 3, 2014, 2:10pm UTC](https://discuss.elastic.co/t/can-mvel-access-a-set-of-documents-from-a-query/16107 "2014-03-03T14:10:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![george\_monroe](https://avatars.discourse-cdn.com/v4/letter/g/bbce88/32.png) [@george\_monroe](https://discuss.elastic.co/u/george_monroe)\
**Post date:** [March 3, 2014, 2:10pm UTC](https://discuss.elastic.co/t/can-mvel-access-a-set-of-documents-from-a-query/16107/1 "2014-03-03T14:10:10Z")

</div>

Guys, I'm trying to aggregate on multiple transaction child records to see if their sum meets a threshold. I want to do this without using the aggs module in 1.0.0 because while it does give me a way to sum, it doesn't really seem to give a way to compare to a threshold after the sum is computed. Can Mvel give me access to a collection of records which are scooped up by some piece of a query higher up on the filtering chain? In other words, if I have a has\_child query and run a range query within that and then try to use Mvel to sum and compare. Is this possible? Or is the only available ctx context per document?

Thanks!

--  
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](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d210c953-e690-46c8-8a74-79decc3d2711%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d210c953-e690-46c8-8a74-79decc3d2711%40googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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:** [July 6, 2017, 1:46am UTC](https://discuss.elastic.co/t/can-mvel-access-a-set-of-documents-from-a-query/16107/2 "2017-07-06T01:46:12Z")

</div>

Closed on July 6, 2017, 1:46am UTC


