Struct elasticsearch_dsl::search::queries::term_level::TermsQuery
source · [−]pub struct TermsQuery { /* private fields */ }
Expand description
Returns documents that contain one or more exact terms in a provided field. The terms query is the same as the term query, except you can search for multiple values.
To create a terms query with numeric values:
Query::terms("test", vec![123]);
To create a terms query with string values and optional fields:
Query::terms("test", vec!["username"])
.boost(2)
.name("test");
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-terms-query.html
Implementations
sourceimpl TermsQuery
impl TermsQuery
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
sourceimpl Clone for TermsQuery
impl Clone for TermsQuery
sourcefn clone(&self) -> TermsQuery
fn clone(&self) -> TermsQuery
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for TermsQuery
impl Debug for TermsQuery
sourceimpl From<TermsQuery> for Query
impl From<TermsQuery> for Query
sourcefn from(q: TermsQuery) -> Self
fn from(q: TermsQuery) -> Self
Converts to this type from the input type.
sourceimpl From<TermsQuery> for Option<Query>
impl From<TermsQuery> for Option<Query>
sourcefn from(q: TermsQuery) -> Self
fn from(q: TermsQuery) -> Self
Converts to this type from the input type.
sourceimpl From<TermsQuery> for Queries
impl From<TermsQuery> for Queries
sourcefn from(q: TermsQuery) -> Self
fn from(q: TermsQuery) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<Query> for TermsQuery
impl PartialEq<Query> for TermsQuery
sourceimpl PartialEq<TermsQuery> for TermsQuery
impl PartialEq<TermsQuery> for TermsQuery
sourcefn eq(&self, other: &TermsQuery) -> bool
fn eq(&self, other: &TermsQuery) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &TermsQuery) -> bool
fn ne(&self, other: &TermsQuery) -> bool
This method tests for !=
.
sourceimpl PartialEq<TermsQuery> for Query
impl PartialEq<TermsQuery> for Query
sourceimpl Serialize for TermsQuery
impl Serialize for TermsQuery
impl StructuralPartialEq for TermsQuery
Auto Trait Implementations
impl RefUnwindSafe for TermsQuery
impl Send for TermsQuery
impl Sync for TermsQuery
impl Unpin for TermsQuery
impl UnwindSafe for TermsQuery
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