Rank results by sorting the matched field

I often have Elasticsearch results searching across multiple fields. Some fields are more important than others, so I use a combination of query weighting and result post-processing to sort results based on the importance of fields. My queries look like:

{"multi_match": {
     "foo": "query",
     "foo.raw^2": "query"

With the hopes that matches on foo.raw show up above matches on foo. But there's no reliable way to make sure that foo.raw shows up above foo Is there a way to tell Elasticsearch to always rank matches on field above another without using boosting?

Hi @leeavital,

there is a whole section about controlling relevance in the Definitive Guide. To me it sounds like you might be interested in function scoring or even script scoring but you should keep an eye on the impact on performance.


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