# Script sorting using matched named queries

**URL:** <https://discuss.elastic.co/t/script-sorting-using-matched-named-queries/132491>\
**Category:** Elasticsearch\
**Created:** [May 18, 2018, 12:54pm UTC](https://discuss.elastic.co/t/script-sorting-using-matched-named-queries/132491 "2018-05-18T12:54:42Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkiselev](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dkiselev/32/1511_2.png) [@dkiselev](https://discuss.elastic.co/u/dkiselev)\
**Post date:** [May 18, 2018, 12:54pm UTC](https://discuss.elastic.co/t/script-sorting-using-matched-named-queries/132491/1 "2018-05-18T12:54:42Z")

</div>

I know that I can't use matched named queries in aggregations, but can I use it for sorting?  
Doing that in my app wouldn't be as fast as doing that on ES shards before returning the results.

---

<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:** [June 15, 2018, 1:00pm UTC](https://discuss.elastic.co/t/script-sorting-using-matched-named-queries/132491/2 "2018-06-15T13:00:04Z")

</div>

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