Struct elasticsearch_dsl::search::queries::term_level::TermQuery
source · [−]pub struct TermQuery { /* private fields */ }
Expand description
Returns documents that contain an exact term in a provided field.
You can use the term query to find documents based on a precise value such as a price, a product ID, or a username.
To create a term query with numeric values:
Query::term("test", 123);
To create a term query with string values and optional fields:
Query::term("test", "username")
.boost(2)
.name("test");
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-term-query.html
Implementations
sourceimpl TermQuery
impl TermQuery
sourcepub fn boost<B>(self, boost: B) -> Self where
B: TryInto<Boost>,
pub fn boost<B>(self, boost: B) -> Self where
B: TryInto<Boost>,
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
impl StructuralPartialEq for TermQuery
Auto Trait Implementations
impl RefUnwindSafe for TermQuery
impl Send for TermQuery
impl Sync for TermQuery
impl Unpin for TermQuery
impl UnwindSafe for TermQuery
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more