Struct elasticsearch_dsl::search::queries::term_level::RangeQuery
source · [−]pub struct RangeQuery { /* private fields */ }
Expand description
Returns documents that contain terms within a provided range.
To create a range query with numeric values:
Query::range("numeric_field")
.gt(1)
.lt(3)
.boost(2)
.name("range_query");
https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-range-query.html
Implementations
sourceimpl RangeQuery
impl RangeQuery
sourcepub fn format(self, format: impl Into<String>) -> Self
pub fn format(self, format: impl Into<String>) -> Self
Date format used to convert date
values in the query.
By default, Elasticsearch uses the
date format
provided in the <field>
’s mapping. This value overrides that mapping format.
For valid syntax, see
format
.
If a format or date value is incomplete, the range query replaces any missing components with default values. See Missing date components.
sourcepub fn relation(self, relation: RangeRelation) -> Self
pub fn relation(self, relation: RangeRelation) -> Self
Indicates how the range query matches values for range fields.
sourcepub fn time_zone(self, time_zone: impl Into<String>) -> Self
pub fn time_zone(self, time_zone: impl Into<String>) -> Self
Coordinated Universal Time (UTC) offset
or IANA time zone
used to convert date
values in the query to UTC.
Valid values are ISO 8601 UTC offsets, such as +01:00
or -08:00
, and IANA time zone IDs,
such as America/Los_Angeles
.
For an example query using the time_zone
parameter, see
Time zone in range
queries.
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 RangeQuery
impl Clone for RangeQuery
sourcefn clone(&self) -> RangeQuery
fn clone(&self) -> RangeQuery
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 RangeQuery
impl Debug for RangeQuery
sourceimpl From<RangeQuery> for Query
impl From<RangeQuery> for Query
sourcefn from(q: RangeQuery) -> Self
fn from(q: RangeQuery) -> Self
Converts to this type from the input type.
sourceimpl From<RangeQuery> for Option<Query>
impl From<RangeQuery> for Option<Query>
sourcefn from(q: RangeQuery) -> Self
fn from(q: RangeQuery) -> Self
Converts to this type from the input type.
sourceimpl From<RangeQuery> for Queries
impl From<RangeQuery> for Queries
sourcefn from(q: RangeQuery) -> Self
fn from(q: RangeQuery) -> Self
Converts to this type from the input type.
sourceimpl PartialEq<Query> for RangeQuery
impl PartialEq<Query> for RangeQuery
sourceimpl PartialEq<RangeQuery> for RangeQuery
impl PartialEq<RangeQuery> for RangeQuery
sourcefn eq(&self, other: &RangeQuery) -> bool
fn eq(&self, other: &RangeQuery) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &RangeQuery) -> bool
fn ne(&self, other: &RangeQuery) -> bool
This method tests for !=
.
sourceimpl PartialEq<RangeQuery> for Query
impl PartialEq<RangeQuery> for Query
sourceimpl Serialize for RangeQuery
impl Serialize for RangeQuery
impl StructuralPartialEq for RangeQuery
Auto Trait Implementations
impl RefUnwindSafe for RangeQuery
impl Send for RangeQuery
impl Sync for RangeQuery
impl Unpin for RangeQuery
impl UnwindSafe for RangeQuery
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