# Sort within a sort - ElasticSearch (DSL / DRF)

**URL:** <https://discuss.elastic.co/t/sort-within-a-sort-elasticsearch-dsl-drf/222479>\
**Category:** Elasticsearch\
**Created:** [March 6, 2020, 3:09pm UTC](https://discuss.elastic.co/t/sort-within-a-sort-elasticsearch-dsl-drf/222479 "2020-03-06T15:09:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Julian\_Camilleri](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/julian_camilleri/32/62617_2.png) [@Julian\_Camilleri](https://discuss.elastic.co/u/Julian_Camilleri)\
**Post date:** [March 6, 2020, 3:09pm UTC](https://discuss.elastic.co/t/sort-within-a-sort-elasticsearch-dsl-drf/222479/1 "2020-03-06T15:09:52Z")

</div>

Context:

Imagine having 10 records, 5 of which are featured. - You want to firstly bring the featured to the top of the list (not sure if it's the best way but done easily via `.sort('-featured')`) , then you want to sort the featured by name, whilst not affecting the other 5 records.

I've been trying to look at nested sorting, script sort among other topics; but can't seem to find anything that documents how to do this - I guess that's because it's simple and should use query and sort in some way?

Thank you for reading. (:

---

<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:** [April 3, 2020, 3:16pm UTC](https://discuss.elastic.co/t/sort-within-a-sort-elasticsearch-dsl-drf/222479/2 "2020-04-03T15:16:37Z")

</div>

Closed on April 3, 2020, 3:16pm UTC

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