# Facet Sorting

**URL:** <https://discuss.elastic.co/t/facet-sorting/247144>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [September 1, 2020, 7:44pm UTC](https://discuss.elastic.co/t/facet-sorting/247144 "2020-09-01T19:44:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe\_Stark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_stark/32/45777_2.png) [@Joe\_Stark](https://discuss.elastic.co/u/Joe_Stark)\
**Post date:** [September 1, 2020, 7:44pm UTC](https://discuss.elastic.co/t/facet-sorting/247144/1 "2020-09-01T19:44:25Z")

</div>

I need some help sorting facets alphabetically rather than by count. I am using the reference UI react project but I am struggling to find where I can set the sort option.

I found that you can do it directly in the API but I don't see the option in reference UI project.

` { "query": "", "facets": { "specialty": [{ "type": "value", "name": "specialty", "sort": { "value": "asc" }, "size": 10 }] } }`

---

<div class="post-metadata">

**Author:** ![Joe\_Stark](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/joe_stark/32/45777_2.png) [@Joe\_Stark](https://discuss.elastic.co/u/Joe_Stark)\
**Post date:** [September 1, 2020, 8:57pm UTC](https://discuss.elastic.co/t/facet-sorting/247144/2 "2020-09-01T20:57:13Z")

</div>

I figured it out. In the app.js modify the config variable and set the sort options there.

'const config = {  
searchQuery: {  
facets: {  
cities: { type: "value", "sort": { "value": "asc" } },  
counties: { type: "value", "sort": { "value": "asc" } },  
gender: { type: "value", "sort": { "value": "asc" } },  
},  
...buildSearchOptionsFromConfig()  
},  
autocompleteQuery: buildAutocompleteQueryConfig(),  
apiConnector: connector,  
alwaysSearchOnInitialLoad: true,  
};'

---

<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:** [September 29, 2020, 8:57pm UTC](https://discuss.elastic.co/t/facet-sorting/247144/3 "2020-09-29T20:57:34Z")

</div>

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