Struct elasticsearch_dsl::search::queries::specialized::ScriptScoreQuery
source · pub struct ScriptScoreQuery { /* private fields */ }
Expand description
A query allowing you to modify the score of documents that are retrieved by a query. This can be useful if, for example, a score function is computationally expensive and it is sufficient to compute the score on a filtered set of documents.
To create script score query:
Query::script_score(
Query::r#match("message", "elasticsearch"),
Script::source("doc['my-int'].value / 10"),
);
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-script-score-query.html
Implementations§
source§impl ScriptScoreQuery
impl ScriptScoreQuery
sourcepub fn boost<T>(self, boost: T) -> Selfwhere
T: AsPrimitive<f32>,
pub fn boost<T>(self, boost: T) -> Selfwhere
T: AsPrimitive<f32>,
Floating point number used to decrease or increase the
relevance scores
of a query. Defaults to 1.0
.
You can use the boost parameter to adjust relevance scores for searches containing two or more queries.
Boost values are relative to the default value of 1.0
.
A boost value between 0 and 1.0
decreases the relevance score.
A value greater than 1.0
increases the relevance score.
Trait Implementations§
source§impl Clone for ScriptScoreQuery
impl Clone for ScriptScoreQuery
source§fn clone(&self) -> ScriptScoreQuery
fn clone(&self) -> ScriptScoreQuery
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScriptScoreQuery
impl Debug for ScriptScoreQuery
source§impl From<ScriptScoreQuery> for Option<Query>
impl From<ScriptScoreQuery> for Option<Query>
source§fn from(q: ScriptScoreQuery) -> Self
fn from(q: ScriptScoreQuery) -> Self
Converts to this type from the input type.
source§impl From<ScriptScoreQuery> for Query
impl From<ScriptScoreQuery> for Query
source§fn from(q: ScriptScoreQuery) -> Self
fn from(q: ScriptScoreQuery) -> Self
Converts to this type from the input type.
source§impl IntoIterator for ScriptScoreQuery
impl IntoIterator for ScriptScoreQuery
§type Item = ScriptScoreQuery
type Item = ScriptScoreQuery
The type of the elements being iterated over.
§type IntoIter = IntoIter<<ScriptScoreQuery as IntoIterator>::Item>
type IntoIter = IntoIter<<ScriptScoreQuery as IntoIterator>::Item>
Which kind of iterator are we turning this into?