# Query Precision/Recall vs Sort

**URL:** https://discuss.elastic.co/t/query-precision-recall-vs-sort/340667
**Category:** Elasticsearch
**Created:** [August 11, 2023, 10:20pm UTC](https://discuss.elastic.co/t/query-precision-recall-vs-sort/340667 "2023-08-11T22:20:11Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![RabBit\_BR](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rabbit_br/32/82261_2.png) [@RabBit\_BR](https://discuss.elastic.co/u/RabBit_BR)
#### Post date: [August 11, 2023, 10:20pm UTC](https://discuss.elastic.co/t/query-precision-recall-vs-sort/340667/1 "2023-08-11T22:20:11Z")

</div>

I have a catalog of products and I'm facing some problems when I try to sort the results by other criteria than by relevance.

Today I can sort the results in order: most recent and most rated.

My query has the characteristic of having the most accurate results on the first page of results and the other pages are the result of recall.

When I try to order the results by the "most rated" criteria, the results on the first page are meaningless with the search term but the document is returned because a word of the search term exists in the document.

Ex:

Search for: english course

```auto
Results:

English course A - Rating 1
English course B - Rating 2
English course C - Rating 3
.
.
.
Makeup course - Rating 5

```

If I order by the best rating, the result is:

```auto
Makeup course - Rating 5
.
.
English course C - Rating 3
English course B - Rating 2
English course A - Rating 1

```

Does anyone have any guidance to get the ordering only in the documents that make sense with the search term?

---

<div class="post-metadata">

### Author: ![Mark\_Harwood1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mark_harwood1/32/101255_2.png) [@Mark\_Harwood1](https://discuss.elastic.co/u/Mark_Harwood1)
#### Post date: [August 12, 2023, 7:59am UTC](https://discuss.elastic.co/t/query-precision-recall-vs-sort/340667/2 "2023-08-12T07:59:55Z")

</div>

One simple alternative is to offer filters rather than sorting. Keep the sort criteria relevance based but offer options to filter by numbers of stars in rating.

---

<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 9, 2023, 8:00am UTC](https://discuss.elastic.co/t/query-precision-recall-vs-sort/340667/3 "2023-09-09T08:00:13Z")

</div>

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