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
Source§impl PartialEq<Query> for TermsQuery
impl PartialEq<Query> for TermsQuery
Source§impl PartialEq<TermsQuery> for Query
impl PartialEq<TermsQuery> for Query
Source§impl PartialEq for TermsQuery
impl PartialEq for TermsQuery
Source§impl Serialize for TermsQuery
impl Serialize for TermsQuery
impl StructuralPartialEq for TermsQuery
Auto Trait Implementations§
impl Freeze for TermsQuery
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