Elasticsearch score based on found keywords


(Jesse Visser) #1

Hi all,

I posted this http://stackoverflow.com/questions/43918945/elasticsearch-score-based-on-found-keywords a few days ago on stackoverflow but without any response.

I hope someone here could help or point me in the right direction.

Thanks in advance!


(Luca Wintergerst) #2

Hi Jesse,
you would want to use a multi match query for this.
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-multi-match-query.html

Hint: you will need most_fields and the operator AND

The scoring will not be exactly as your sample calculations, but you should still get similar results.
If you want to understand why, consider reading these and the following chapters of the definitive guide:
https://www.elastic.co/guide/en/elasticsearch/guide/current/relevance-intro.html
https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.html

Let me know if that is enough information to help you out :slight_smile:

Luca


(Eike Dehling) #3

Hi Jesse, Luca,

you should also be able to use boosting to produce the difference in "weight" of the title vs content field, so that a hit in the title field will count more than a hit in the content field.

This should also work well together with the suggestion above!

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html

Cheers, Eike


(system) #4

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