Struct elasticsearch_dsl::search::queries::params::RandomScore
source · [−]pub struct RandomScore { /* private fields */ }Expand description
The random_score generates scores that are uniformly distributed from 0 up to but not
including 1.
By default, it uses the internal Lucene doc ids as a source of randomness, which is very efficient but unfortunately not reproducible since documents might be renumbered by merges.
In case you want scores to be reproducible, it is possible to provide a seed and field. The
final score will then be computed based on this seed, the minimum value of field for the
considered document and a salt that is computed based on the index name and shard id so that
documents that have the same value but are stored in different indexes get different scores.
Note that documents that are within the same shard and have the same value for field will
however get the same score, so it is usually desirable to use a field that has unique values
for all documents. A good default choice might be to use the _seq_no field, whose only
drawback is that scores will change if the document is updated since update operations also
update the value of the _seq_no field.
Implementations
Trait Implementations
sourceimpl Clone for RandomScore
impl Clone for RandomScore
sourcefn clone(&self) -> RandomScore
fn clone(&self) -> RandomScore
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more