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§
source§impl TermsQuery
impl TermsQuery
pub fn serialize<__S>(
__self: &TermsQuery,
__serializer: __S
) -> Result<__S::Ok, __S::Error>where
__S: Serializer,
source§impl TermsQuery
impl TermsQuery
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 TermsQuery
impl Clone for TermsQuery
source§fn clone(&self) -> TermsQuery
fn clone(&self) -> TermsQuery
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 TermsQuery
impl Debug for TermsQuery
source§impl From<TermsQuery> for Option<Query>
impl From<TermsQuery> for Option<Query>
source§fn from(q: TermsQuery) -> Self
fn from(q: TermsQuery) -> Self
Converts to this type from the input type.
source§impl From<TermsQuery> for Query
impl From<TermsQuery> for Query
source§fn from(q: TermsQuery) -> Self
fn from(q: TermsQuery) -> Self
Converts to this type from the input type.
source§impl IntoIterator for TermsQuery
impl IntoIterator for TermsQuery
§type Item = TermsQuery
type Item = TermsQuery
The type of the elements being iterated over.
§type IntoIter = IntoIter<<TermsQuery as IntoIterator>::Item>
type IntoIter = IntoIter<<TermsQuery as IntoIterator>::Item>
Which kind of iterator are we turning this into?
source§impl PartialEq<Query> for TermsQuery
impl PartialEq<Query> for TermsQuery
source§impl PartialEq<TermsQuery> for Query
impl PartialEq<TermsQuery> for Query
source§fn 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 ==
.source§impl PartialEq for TermsQuery
impl PartialEq for TermsQuery
source§fn 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 ==
.source§impl 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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more