# Random\_score , how to moderate its impact?

**URL:** <https://discuss.elastic.co/t/random-score-how-to-moderate-its-impact/241555>\
**Category:** Elasticsearch\
**Created:** [July 16, 2020, 10:02pm UTC](https://discuss.elastic.co/t/random-score-how-to-moderate-its-impact/241555 "2020-07-16T22:02:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ClubberLang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/clubberlang/32/72169_2.png) [@ClubberLang](https://discuss.elastic.co/u/ClubberLang)\
**Post date:** [July 16, 2020, 10:02pm UTC](https://discuss.elastic.co/t/random-score-how-to-moderate-its-impact/241555/1 "2020-07-16T22:02:27Z")

</div>

Hi,

I use the following query, in this one I have 2 functions:

- distance\_feature : compute a score based on distance
- random\_score : compute a value between 0 and 1

The final score = distance\_feature \* random\_score

The problem is that I have such situation:

```
distance_feature = 0.9
random_score = 0.001

=> score = 0.0009

```

and so, something that is near of the origin point, will be put at the end of the results !  
The random\_score 'absord' the distance\_feature !

I'm looking for a way to compute something like this, in order to moderate its impact:

```
distance_feature + (distance_feature * 0.2) * random_score 

```

The result will be something that vary between 100% and 120%:

0.9 + (0.9 \* 0.2) \* 0.0009 = 0.9009

PS: noticed that I wish to use it with pagination (So, using script\_score does seems possible without having some duplicates).

Here is my query, for example:

> GET /\_search  
> {  
> "explain": true,  
> "query": {  
> "function\_score": {  
> "query": {  
> "bool": {  
> "should": [  
> {  
> "distance\_feature": {  
> "field": "geoLocations",  
> "pivot": "20km",  
> "origin": [-71.3,41.15]  
> }  
> }  
> ]  
> }  
> },  
> "random\_score": {},  
> "boost": "1",  
> "boost\_mode": "multiply"  
> }  
> }  
> }

---

<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 13, 2020, 10:02pm UTC](https://discuss.elastic.co/t/random-score-how-to-moderate-its-impact/241555/2 "2020-08-13T22:02:27Z")

</div>

Closed on August 13, 2020, 10:02pm UTC

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