# Elasticsearch score based on found keywords

**URL:** <https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761>\
**Category:** Elasticsearch\
**Created:** [May 15, 2017, 12:24pm UTC](https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761 "2017-05-15T12:24:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jesse\_Visser](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jesse_visser/32/18208_2.png) [@Jesse\_Visser](https://discuss.elastic.co/u/Jesse_Visser)\
**Post date:** [May 15, 2017, 12:24pm UTC](https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761/1 "2017-05-15T12:24:23Z")

</div>

Hi all,

I posted this [http://stackoverflow.com/questions/43918945/elasticsearch-score-based-on-found-keywords](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!

---

<div class="post-metadata">

**Author:** ![lwintergerst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lwintergerst/32/18164_2.png) [@lwintergerst](https://discuss.elastic.co/u/lwintergerst)\
**Post date:** [May 15, 2017, 8:32pm UTC](https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761/2 "2017-05-15T20:32:22Z")

</div>

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](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/relevance-intro.html)  
[https://www.elastic.co/guide/en/elasticsearch/guide/current/scoring-theory.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 🙂

Luca

---

<div class="post-metadata">

**Author:** ![EikeD](https://avatars.discourse-cdn.com/v4/letter/e/74df32/32.png) [@EikeD](https://discuss.elastic.co/u/EikeD)\
**Post date:** [May 16, 2017, 8:49am UTC](https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761/3 "2017-05-16T08:49:40Z")

</div>

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](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-boost.html)

Cheers, Eike

---

<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:** [June 13, 2017, 8:59am UTC](https://discuss.elastic.co/t/elasticsearch-score-based-on-found-keywords/85761/4 "2017-06-13T08:59:55Z")

</div>

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