Struct elasticsearch_dsl::search::queries::params::FieldValueFactor [−][src]
pub struct FieldValueFactor { /* fields omitted */ }
Expand description
The field_value_factor
function allows you to use a field from a document to influence the
score.
It’s similar to using the script_score
function, however, it avoids the overhead of scripting.
If used on a multi-valued field, only the first value of the field is used in calculations.
As an example, imagine you have a document indexed with a numeric my-int
field and wish to
influence the score of a document with this field, an example doing so would look like:
FieldValueFactor::new("my-int")
.factor(1.2)
.modifier(FieldValueFactorModifier::Sqrt)
.missing(1.0)
Which will translate into the following formula for scoring:
sqrt(1.2 * doc['my-int'].value)
Implementations
Creates an instance of FieldValueFactor
field
- Field to be extracted from the document.
Modifier to apply to the field value
Trait Implementations
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for FieldValueFactor
impl Send for FieldValueFactor
impl Sync for FieldValueFactor
impl Unpin for FieldValueFactor
impl UnwindSafe for FieldValueFactor
Blanket Implementations
Mutably borrows from an owned value. Read more