# App Search Sort by Id ASC incorrect

**URL:** <https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857>\
**Category:** Elastic Search\
**Tags:** elastic-app-search\
**Created:** [August 13, 2020, 10:31am UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857 "2020-08-13T10:31:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 13, 2020, 10:31am UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/1 "2020-08-13T10:31:04Z")

</div>

Sorting by Id doesn't seem to work with AppSeach/Enterprise search. Please see the reference UI sort by id. For some reason the id starting with b is before the id starting with a.

 ![Screen Shot 2020-08-13 at 11.28.47](https://us1.discourse-cdn.com/elastic/original/3X/6/3/63e6e57e321c133260f27b8eefdbf68453ef45b9.png)

Am i missing something?

Also is it possible to sort by name - but case insensitive?

Thanks,

Ben

---

<div class="post-metadata">

**Author:** ![JasonStoltz](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jasonstoltz/32/49893_2.png) [@JasonStoltz](https://discuss.elastic.co/u/JasonStoltz)\
**Post date:** [August 13, 2020, 3:19pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/2 "2020-08-13T15:19:20Z")

</div>

Sorting by id should work.

And i don't think you have that level of control over sorting. You could try indexing name into a separate field that is lower cased for sorting.

---

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 14, 2020, 2:17pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/3 "2020-08-14T14:17:42Z")

</div>

Hi Jason, Thanks for the reply

> Sorting by id should work.

The image above is showing the "reference" UI generated by app search - so it's decinitely out of order based on the id.

Any idea why this would be the case?

---

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 14, 2020, 2:17pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/4 "2020-08-14T14:17:57Z")

</div>

@JasonStoltz

---

<div class="post-metadata">

**Author:** ![Mark\_Harwood](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood/32/10538_2.png) [@Mark\_Harwood](https://discuss.elastic.co/u/Mark_Harwood)\
**Post date:** [August 14, 2020, 2:26pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/5 "2020-08-14T14:26:10Z")

</div>

> [@Ben\_Flowers](#):
>
> Any idea why this would be the case?

I wonder if the case discrepancy in your example query is a factor - `Id != id` ?

---

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 14, 2020, 2:35pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/6 "2020-08-14T14:35:28Z")

</div>

Hi @Mark_Harwood ,

The UI generates the labels from the document properties - so think it's just capitalized in the label. I'm seeing this same behaviour in my own UI too

---

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 24, 2020, 9:45am UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/7 "2020-08-24T09:45:37Z")

</div>

Hi There,

Ok now strangely enough the order seems to have changed?

 ![Screen Shot 2020-08-24 at 10.44.00](https://us1.discourse-cdn.com/elastic/original/3X/e/d/ed777284e37ec7be4cb53dc524ba6f4530b8d696.png)

I have not changed the query in any way whatsoever - however now there seems to be other items out of order which have been added more recently.

Is there someone from the appsearch team I can chat to to get this sorted?

---

<div class="post-metadata">

**Author:** ![orhantoy](https://avatars.discourse-cdn.com/v4/letter/o/c5a1d2/32.png) [@orhantoy](https://discuss.elastic.co/u/orhantoy)\
**Post date:** [August 25, 2020, 8:44am UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/8 "2020-08-25T08:44:23Z")

</div>

Thanks for reporting this @Ben_Flowers. I can confirm the issue and that we'll have it addressed in an upcoming release.

---

<div class="post-metadata">

**Author:** ![Ben\_Flowers](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ben_flowers/32/45225_2.png) [@Ben\_Flowers](https://discuss.elastic.co/u/Ben_Flowers)\
**Post date:** [August 25, 2020, 10:30am UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/9 "2020-08-25T10:30:06Z")

</div>

OK great thanks for that - was convinced i must have been doing something wrong!  
Is there an ETA on the upcoming release?

---

<div class="post-metadata">

**Author:** ![orhantoy](https://avatars.discourse-cdn.com/v4/letter/o/c5a1d2/32.png) [@orhantoy](https://discuss.elastic.co/u/orhantoy)\
**Post date:** [September 7, 2020, 3:52pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/10 "2020-09-07T15:52:01Z")

</div>

@Ben_Flowers The recent 7.9.1 release should include a fix for this.

---

<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:** [October 5, 2020, 3:52pm UTC](https://discuss.elastic.co/t/app-search-sort-by-id-asc-incorrect/244857/11 "2020-10-05T15:52:04Z")

</div>

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