# How to set the default Sort Field and Sort Order in App Search Reference UI

**URL:** <https://discuss.elastic.co/t/how-to-set-the-default-sort-field-and-sort-order-in-app-search-reference-ui/274973>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [June 4, 2021, 10:56am UTC](https://discuss.elastic.co/t/how-to-set-the-default-sort-field-and-sort-order-in-app-search-reference-ui/274973 "2021-06-04T10:56:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anuragchoudhary01](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anuragchoudhary01/32/83611_2.png) [@anuragchoudhary01](https://discuss.elastic.co/u/anuragchoudhary01)\
**Post date:** [June 4, 2021, 10:56am UTC](https://discuss.elastic.co/t/how-to-set-the-default-sort-field-and-sort-order-in-app-search-reference-ui/274973/1 "2021-06-04T10:56:43Z")

</div>

Hi Team,

I have created the Search UI using the reference UI from app search, but in this, the default Sort Field is set to **Relevance** , I need to override this field with one of my fields as I need to see the data in the Result View on the basis of the sort field which I have overridden.  
Please advise.

---

<div class="post-metadata">

**Author:** ![anuragchoudhary01](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anuragchoudhary01/32/83611_2.png) [@anuragchoudhary01](https://discuss.elastic.co/u/anuragchoudhary01)\
**Post date:** [June 7, 2021, 9:11am UTC](https://discuss.elastic.co/t/how-to-set-the-default-sort-field-and-sort-order-in-app-search-reference-ui/274973/2 "2021-06-07T09:11:20Z")

</div>

Never mind, I got it. It will be set in the initialState (of SearchProvider config).

```auto
    <SearchProvider
        config={
            ...
            initialState: {
                resultsPerPage: 5
            }
        }
    >

```

---

<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 5, 2021, 9:12am UTC](https://discuss.elastic.co/t/how-to-set-the-default-sort-field-and-sort-order-in-app-search-reference-ui/274973/3 "2021-07-05T09:12:11Z")

</div>

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