# Random score combine with boost?

**URL:** <https://discuss.elastic.co/t/random-score-combine-with-boost/93555>\
**Category:** Elasticsearch\
**Created:** [July 18, 2017, 10:40am UTC](https://discuss.elastic.co/t/random-score-combine-with-boost/93555 "2017-07-18T10:40:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mads\_Odgaard](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mads_odgaard/32/20087_2.png) [@Mads\_Odgaard](https://discuss.elastic.co/u/Mads_Odgaard)\
**Post date:** [July 18, 2017, 10:40am UTC](https://discuss.elastic.co/t/random-score-combine-with-boost/93555/1 "2017-07-18T10:40:06Z")

</div>

I am building a iOS app with Firebase, and using ElasticSearch as a search engine to get more advanced queries.

I am trying to achieve a system where I can get a random record from the index, based on a query. I have already got this working using the "random\_score" function with a seed.

So all documents should right now have equal chance of being selected. Is it possible to add a boost or something(sorry, I am new to ES)?

Let's say the the document has the field "boost\_enabled" and it set to true, the document will be 3 times more likely to be selected, so "increasing" the chance of being selected as a random?

So in theory it should look like this:

Documents that matches the query:

"document1"  
"document2"  
"document3"  
They all have an equal chance of being selected (33%)

What I wish to achieve is if "document1" has the field "boost\_enabled" = true

It should look like this:

"document1"  
"document1"  
"document1"  
"document2"  
"document3"  
So now "document1" is 3 times more likely to be selected as the random record.

Would really appreciate some help.

/ Mads

---

<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 15, 2017, 10:40am UTC](https://discuss.elastic.co/t/random-score-combine-with-boost/93555/2 "2017-08-15T10:40:20Z")

</div>

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