# Normalize query score before boost\_mode when using function\_score

**URL:** https://discuss.elastic.co/t/normalize-query-score-before-boost-mode-when-using-function-score/193462
**Category:** Elasticsearch
**Created:** [August 2, 2019, 6:54am UTC](https://discuss.elastic.co/t/normalize-query-score-before-boost-mode-when-using-function-score/193462 "2019-08-02T06:54:33Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![hangu\_choi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hangu_choi/32/49745_2.png) [@hangu\_choi](https://discuss.elastic.co/u/hangu_choi)
#### Post date: [August 2, 2019, 6:54am UTC](https://discuss.elastic.co/t/normalize-query-score-before-boost-mode-when-using-function-score/193462/1 "2019-08-02T06:54:33Z")

</div>

This topic [seems appear before,](https://discuss.elastic.co/t/normalizing-scores/17749/5) but I couldn't find useful answer for that.

With `function_score` query,  
Is there any way to normalize `query score` before calculate with `function score` by `boost_mode`?

The intention here is keeping same weight for `query score` and `function score`.

As I know, `query score` range can be different.  
For example, with `cross_fields` type, it seems that more query terms return bigger score.

### search request A

| **query** | **doc** | **query score** | **function score** | **final score** | **order** |
| --- | --- | --- | --- | --- | --- |
| developer | doc1 | 50 | 35 | 85 | 2 |
| developer | doc2 | 40 | 50 | 90 | 1 |

### search request B

| **query** | **doc** | **query score** | **function score** | **final score** | **order** |
| --- | --- | --- | --- | --- | --- |
| developer programmer software engineer web ruby | doc1 | 100 | 35 | 135 | 1 |
| developer programmer software engineer web ruby | doc2 | 80 | 50 | 130 | 2 |

The result order is different due to the weight of function score.

Can I normalize query score like below?

### search request B

| **query** | **doc** | **query score** | **function score** | **final score** | **order** |
| --- | --- | --- | --- | --- | --- |
| developer programmer software engineer web ruby | doc1 | 50 | 35 | 85 | 2 |
| developer programmer software engineer web ruby | doc2 | 40 | 50 | 90 | 1 |

---

<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: [August 30, 2019, 6:54am UTC](https://discuss.elastic.co/t/normalize-query-score-before-boost-mode-when-using-function-score/193462/2 "2019-08-30T06:54:35Z")

</div>

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