How to Output Display the Document Scoring

Hello Elastic,

I need help on how do we display the document scoring based on the search results?

For example like the Score on top of the Captain Marvel.

I've tried to explore the code but couldn't find on the specific scoring part.

Appreciate your guidance thank you.

@aisyaharifin I strongly suggest that you not display the score values. These are not normalized, and don't have any concrete meaning - they are only relevant for a given instance of a given query, and only relevant to show relative ranking of results. We find that when folks start to pay attention to the values, they then start to be confused or frustrated when those values change from query to query, and therefore it's better to just display results sorted by score, but not display the actual score values.

Hi @Sean_Story, thank you for your reply, I see so the value is not normalized.

Well, this is because the requirement from the user is to show the ranking of the results so that they can choose which one is more accurate based on the query that they enter.

The requirement is the searching must be able to find the query attribute that has been enter to display (highlight attribute) result based on accuracy of total attribute found.

For example if they enter 4 different attribute query like "chicken,leg,bird,wing" top result will be 4/4 attribute found followed by ¾ found or at least 60% accuracy.

You mentioned :

therefore it's better to just display results sorted by score, but not display the actual score values.

How do we display results sorted by score?

Thank you for your assistance.

Elasticsearch's and App Search's default result ordering is sorted by score.

For example if they enter 4 different attribute query like "chicken,leg,bird,wing" top result will be 4/4 attribute found followed by ¾ found or at least 60% accuracy

This is how Elasticsearch and App Search relevance works, broadly. It becomes more complex if you use things like synonyms, so that "chicken,leg,bird,wing" matches a document like "checken,leg,poultry,wing", or stemming which might match "chickens,legs,birds,wings", or typo-tolerance, etc. If there are some concrete examples of queries that don't return the results in the order you're expecting, please share details and we can try to troubleshoot how to tune your relevance settings so that you get them ordered as expected.

So how do I display the score? Is there a code reference for this?

score is a field that should be present in the response object for each result. But again, I strongly recommend against displaying score, as the values have no intrinsic meaning, and their relative ordering is all that matters.

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