# Problem on scoring and sorting retrieved documents

**URL:** <https://discuss.elastic.co/t/problem-on-scoring-and-sorting-retrieved-documents/80113>\
**Category:** Elasticsearch\
**Created:** [March 27, 2017, 9:40am UTC](https://discuss.elastic.co/t/problem-on-scoring-and-sorting-retrieved-documents/80113 "2017-03-27T09:40:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grigorios\_Loukidis](https://avatars.discourse-cdn.com/v4/letter/g/f17d59/32.png) [@Grigorios\_Loukidis](https://discuss.elastic.co/u/Grigorios_Loukidis)\
**Post date:** [March 27, 2017, 9:40am UTC](https://discuss.elastic.co/t/problem-on-scoring-and-sorting-retrieved-documents/80113/1 "2017-03-27T09:40:37Z")

</div>

Hello!I am using EdgeNGram on Elastic only on my index analyzer (not on my search analyzer) and Fuzziness.Auto on my search analyzer.The main problem is that I get the correct results but with wrong sorting.  
For example if I type elephant, I will get elephants with higher score than [elephant.Is](http://elephant.Is) there any help or suggestion?Thank you in advance!

---

<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:** [March 27, 2017, 12:27pm UTC](https://discuss.elastic.co/t/problem-on-scoring-and-sorting-retrieved-documents/80113/2 "2017-03-27T12:27:00Z")

</div>

Matching is a combination of a number of factors relating to your choice of analyzers and queries and the documents held inside your index. The explain API [1] can give low-level details on how things are matched.

Before you dive into this it is worth noting that the user's search text input does not have to be translated into a single choice of query clause in the elasticsearch query DSL. It often makes sense to combine multiple query expressions ranging from strict to lax in a single `bool` query's array of `should` expressions. Documents that match all of the expressions (strict and lax) will tend to rank highest. An example of a strict clause might be a query for an exact phrase match on a field analyzed with no stemming etc while an example of a sloppy clause might be the ngram approach you have here.  
Thread: [Synonym Problem](https://discuss.elastic.co/t/synonym-problem/74695/3?u=mark_harwood)

Cheers  
Mark

[1] [https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html](https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html)

---

<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 24, 2017, 12:27pm UTC](https://discuss.elastic.co/t/problem-on-scoring-and-sorting-retrieved-documents/80113/3 "2017-04-24T12:27:06Z")

</div>

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