Enum elasticsearch_dsl::search::queries::Query [−][src]
pub enum Query {
Show 38 variants
Bool(BoolQuery),
Prefix(PrefixQuery),
Regexp(RegexpQuery),
Wildcard(WildcardQuery),
TermsSet(TermsSetQuery),
Term(TermQuery),
TermsValues(TermsQuery<BTreeSet<Scalar>>),
TermsLookup(TermsQuery<TermsLookup>),
Exists(ExistsQuery),
Range(RangeQuery),
Ids(IdsQuery),
ConstantScore(ConstantScoreQuery),
DistanceFeatureDate(DistanceFeatureQuery<DateTime<Utc>>),
DistanceFeatureGeo(DistanceFeatureQuery<GeoPoint>),
Match(MatchQuery),
MatchBoolPrefix(MatchBoolPrefixQuery),
MatchPhrasePrefix(MatchPhrasePrefixQuery),
MatchAll(MatchAllQuery),
MatchNone(MatchNoneQuery),
MatchPhrase(MatchPhraseQuery),
MultiMatch(MultiMatchQuery),
Nested(NestedQuery),
Boosting(BoostingQuery),
DisMax(DisMaxQuery),
PercolateDocument(PercolateQuery<Value>),
PercolateDocuments(PercolateQuery<Vec<Value>>),
PercolateLookup(PercolateQuery<PercolateLookup>),
FunctionScore(FunctionScoreQuery),
RankFeature(RankFeatureQuery),
RankFeatureSaturation(RankFeatureSaturationQuery),
RankFeatureLogarithm(RankFeatureLogarithmQuery),
RankFeatureSigmoid(RankFeatureSigmoidQuery),
RankFeatureLinear(RankFeatureLinearQuery),
MoreLikeThis(MoreLikeThisQuery),
Fuzzy(FuzzyQuery),
GeoDistance(GeoDistanceQuery),
GeoBoundingBox(GeoBoundingBoxQuery),
Json(JsonQuery),
}
Expand description
A container enum for supported Elasticsearch query types
Variants
Bool(BoolQuery)
Tuple Fields
0: BoolQuery
Prefix(PrefixQuery)
Tuple Fields
0: PrefixQuery
Regexp(RegexpQuery)
Tuple Fields
0: RegexpQuery
Wildcard(WildcardQuery)
Tuple Fields
TermsSet(TermsSetQuery)
Tuple Fields
Term(TermQuery)
Tuple Fields
0: TermQuery
TermsValues(TermsQuery<BTreeSet<Scalar>>)
Tuple Fields
0: TermsQuery<BTreeSet<Scalar>>
TermsLookup(TermsQuery<TermsLookup>)
Tuple Fields
Exists(ExistsQuery)
Tuple Fields
0: ExistsQuery
Range(RangeQuery)
Tuple Fields
0: RangeQuery
Ids(IdsQuery)
Tuple Fields
0: IdsQuery
ConstantScore(ConstantScoreQuery)
Tuple Fields
DistanceFeatureDate(DistanceFeatureQuery<DateTime<Utc>>)
Tuple Fields
DistanceFeatureGeo(DistanceFeatureQuery<GeoPoint>)
Tuple Fields
Match(MatchQuery)
Tuple Fields
0: MatchQuery
MatchBoolPrefix(MatchBoolPrefixQuery)
Tuple Fields
MatchPhrasePrefix(MatchPhrasePrefixQuery)
Tuple Fields
MatchAll(MatchAllQuery)
Tuple Fields
MatchNone(MatchNoneQuery)
Tuple Fields
MatchPhrase(MatchPhraseQuery)
Tuple Fields
MultiMatch(MultiMatchQuery)
Tuple Fields
Nested(NestedQuery)
Tuple Fields
0: NestedQuery
Boosting(BoostingQuery)
Tuple Fields
DisMax(DisMaxQuery)
Tuple Fields
0: DisMaxQuery
PercolateDocument(PercolateQuery<Value>)
Tuple Fields
0: PercolateQuery<Value>
PercolateDocuments(PercolateQuery<Vec<Value>>)
Tuple Fields
0: PercolateQuery<Vec<Value>>
PercolateLookup(PercolateQuery<PercolateLookup>)
Tuple Fields
FunctionScore(FunctionScoreQuery)
Tuple Fields
RankFeature(RankFeatureQuery)
Tuple Fields
RankFeatureSaturation(RankFeatureSaturationQuery)
Tuple Fields
RankFeatureLogarithm(RankFeatureLogarithmQuery)
Tuple Fields
RankFeatureSigmoid(RankFeatureSigmoidQuery)
Tuple Fields
RankFeatureLinear(RankFeatureLinearQuery)
Tuple Fields
MoreLikeThis(MoreLikeThisQuery)
Tuple Fields
Fuzzy(FuzzyQuery)
Tuple Fields
0: FuzzyQuery
GeoDistance(GeoDistanceQuery)
Tuple Fields
GeoBoundingBox(GeoBoundingBoxQuery)
Tuple Fields
Json(JsonQuery)
Tuple Fields
0: JsonQuery
Implementations
pub fn boosting<Q, B>(
positive: Q,
negative: Q,
negative_boost: B
) -> BoostingQuery where
Q: Into<Query>,
B: Into<NegativeBoost>,
pub fn boosting<Q, B>(
positive: Q,
negative: Q,
negative_boost: B
) -> BoostingQuery where
Q: Into<Query>,
B: Into<NegativeBoost>,
Creates an instance of BoostingQuery
positive
- Query you wish to run. Any returned documents must match this query.negative
- Query used to decrease the relevance score of matching documents.
If a returned document matches thepositive
query and this query, theboosting
query calculates the final relevance score for the document as follows:- Take the original relevance score from the
positive
query. - Multiply the score by the
negative_boost
value.
- Take the original relevance score from the
negative_boost
- Floating point number between0
and1.0
used to decrease the relevance scores of documents matching thenegative
query.
Creates an instance of ConstantScoreQuery
filter
- Filter query you wish to run. Any returned documents must match this query.
Filter queries do not calculate relevance scores. To speed up performance, Elasticsearch automatically caches frequently used filter queries.
Creates an instance of DisMaxQuery
Creates an instance of FunctionScoreQuery
pub fn combined_fields<F, S>(fields: F, query: S) -> CombinedFieldsQuery where
F: IntoIterator,
F::Item: ToString,
S: Into<String>,
pub fn combined_fields<F, S>(fields: F, query: S) -> CombinedFieldsQuery where
F: IntoIterator,
F::Item: ToString,
S: Into<String>,
Creates an instance of CombinedFieldsQuery
fields
- List of fields to search. Field wildcard patterns are allowed. Only text fields are supported, and they must all have the same search analyzer.query
- Text to search for in the provided<fields>
. The combined_fields query analyzes the provided text before performing a search.
pub fn match_bool_prefix(
field: impl Into<String>,
query: impl Into<String>
) -> MatchBoolPrefixQuery
pub fn match_bool_prefix(
field: impl Into<String>,
query: impl Into<String>
) -> MatchBoolPrefixQuery
Creates an instance of MatchBoolPrefixQuery
field
- Field you wish to search.query
- Text, number, boolean value or date you wish to find in the provided<field>
pub fn match_phrase_prefix(
field: impl Into<String>,
query: impl Into<String>
) -> MatchPhrasePrefixQuery
pub fn match_phrase_prefix(
field: impl Into<String>,
query: impl Into<String>
) -> MatchPhrasePrefixQuery
Creates an instance of MatchPhrasePrefixQuery
field
- Field you wish to search.query
- Text you wish to find in the provided.
Thematch_phrase_prefix
query analyzes any provided text into tokens before performing a search. The last term of this text is treated as a prefix, matching any words that begin with that term.
Creates an instance of MatchPhraseQuery
field
- Field you wish to search.query
- Text, number, boolean value or date you wish to find in the provided<field>
.
Thematch_phrase
query analyzes any provided text before performing a search. This means thematch_phrase
query can searchtext
fields for analyzed tokens rather than an exact term.
Creates an instance of MatchQuery
pub fn multi_match<F, S>(fields: F, query: S) -> MultiMatchQuery where
F: IntoIterator,
F::Item: ToString,
S: Into<String>,
pub fn multi_match<F, S>(fields: F, query: S) -> MultiMatchQuery where
F: IntoIterator,
F::Item: ToString,
S: Into<String>,
Creates an instance of MultiMatchQuery
Creates an instance of QueryStringQuery
query
- Query string you wish to parse and use for search. See Simple query string syntax.
Creates an instance of SimpleQueryStringQuery
query
- Query string you wish to parse and use for search. See Simple query string syntax.
pub fn geo_bounding_box(
field: impl Into<String>,
value: impl Into<GeoBoundingBox>
) -> GeoBoundingBoxQuery
pub fn geo_bounding_box(
field: impl Into<String>,
value: impl Into<GeoBoundingBox>
) -> GeoBoundingBoxQuery
Creates an instance of GeoBoundingBoxQuery
field
- Field you wish to search.value
- A series of vertex coordinates of a geo bounding box
pub fn geo_distance(
field: impl Into<String>,
origin: impl Into<GeoPoint>,
distance: impl Into<Distance>
) -> GeoDistanceQuery
pub fn geo_distance(
field: impl Into<String>,
origin: impl Into<GeoPoint>,
distance: impl Into<Distance>
) -> GeoDistanceQuery
Creates an instance of GeoDistanceQuery
field
- Field you wish to searchorigin
- GeoPoint to measure distance todistance
- Distance threshold
Creates an instance of HasChildQuery
type
- Name of the child relationship mapped for the join field.query
- Query you wish to run on child documents of thetype
field. If a child document matches the search, the query returns the parent document.
Creates an instance of HasParentQuery
parent-type
- Name of the parent relationship mapped for the join field.query
- Query you wish to run on parent documents of theparent_type
field. If a parent document matches the search, the query returns its child documents.
Creates an instance of NestedQuery
path
- Path to the nested object you wish to search.query
- Query you wish to run on nested objects in thepath
. If an object matches the search, thenested
query returns the root parent document.
You can search nested fields using dot notation that includes the complete path, such asobj1.name
.
Multi-level nesting is automatically supported, and detected, resulting in an inner nested query to automatically match the relevant nesting level, rather than root, if it exists within another nested query.
Multi-level nested queries are also supported.
Creates an instance of ParentIdQuery
type
- Name of the child relationship mapped for the join fieldid
- ID of the parent document. The query will return child documents of this parent document.
pub fn distance_feature<O: Origin>(
field: impl Into<String>,
origin: O,
pivot: <O as Origin>::Pivot
) -> DistanceFeatureQuery<O>
pub fn distance_feature<O: Origin>(
field: impl Into<String>,
origin: O,
pivot: <O as Origin>::Pivot
) -> DistanceFeatureQuery<O>
Creates an instance of DistanceFeatureQuery
field
- Name of the field used to calculate distances. This field must meet the following criteria:
- Be a
date
,date_nanos
orgeo_point
field - Have an index
mapping parameter value of
true
, which is the default - Have an
doc_values
mapping parameter value oftrue
, which is the default
- Be a
origin
- Date or point of origin used to calculate distances.
If thefield
value is adate
ordate_nanos
field, theorigin
value must be a date. Date Math, such asnow-1h
, is supported.
If thefield
value is ageo_point
field, theorigin
value must be a geopoint.pivot
- Distance from theorigin
at which relevance scores receive half of the boost value.
If the field value is adate
ordate_nanos
field, thepivot
value must be atime unit
, such as1h
or10d
.
If thefield
value is ageo_point
field, thepivot
value must be a distance unit , such as1km
or12m
.
pub fn more_like_this<I>(like: I) -> MoreLikeThisQuery where
I: IntoIterator,
I::Item: Into<Like>,
pub fn more_like_this<I>(like: I) -> MoreLikeThisQuery where
I: IntoIterator,
I::Item: Into<Like>,
Creates an instance of MoreLikeThisQuery
like
- free form text and/or a single or multiple documents.
pub fn percolate<T: PercolateMarker>(
field: impl Into<String>,
source: T
) -> PercolateQuery<T>
pub fn percolate<T: PercolateMarker>(
field: impl Into<String>,
source: T
) -> PercolateQuery<T>
Creates an instance of PercolateQuery
field
- The field of typepercolator
that holds the indexed queriessource
- Source to percolate
pub fn percolate_lookup<S>(
field: S,
index: S,
id: S
) -> PercolateQuery<PercolateLookup> where
S: Into<String>,
pub fn percolate_lookup<S>(
field: S,
index: S,
id: S
) -> PercolateQuery<PercolateLookup> where
S: Into<String>,
Creates an instance of PercolateQuery
field
- The field of typepercolator
that holds the indexed queriesindex
- The index the document resides inid
- The id of the document to fetch
Creates an instance of RankFeatureQuery
field
-rank_feature
orrank_features
field used to boost relevance scores
Creates an instance of ExistsQuery
field
- Name of the field you wish to search. While a field is deemed non-existent if the JSON value isnull
or[]
, these values will indicate the field does exist:- Empty strings, such as
""
or"-"
- Arrays containing
null
and another value, such as[null, "foo"]
- A custom
null-value
, defined in field mapping
- Empty strings, such as
Creates an instance of FuzzyQuery
field
- Field you wish to search.value
- Fuzzy you wish to find in the provided field.
Creates an instance of IdsQuery
values
- An array of document IDs.
Creates an instance of PrefixQuery
field
- Field you wish to search.value
- Term you wish to find in the provided field. To return a document, the term must exactly match the field value, including whitespace and capitalization.
Creates an instance of RangeQuery
field
- Field you wish to search.
Creates an instance of RegexpQuery
field
- Field you wish to search.value
- Regular expression for terms you wish to find in the provided field. For a list of supported operators, see Regular expression syntax.
By default, regular expressions are limited to 1,000 characters. You can change this limit
using the
index.max_regex_length
setting.
Creates an instance of TermQuery
field
- Field you wish to search.value
- Term you wish to find in the provided field. To return a document, the term must exactly match the field value, including whitespace and capitalization.
Creates an instance of TermsQuery
field
- Field you wish to search.values
- An array of terms you wish to find in the provided field. To return a document, one or more terms must exactly match a field value, including whitespace and capitalization.
By default, Elasticsearch limits theterms
query to a maximum of 65,536 terms. You can change this limit using theindex.max_terms_count setting
.
To use the field values of an existing document as search terms, use the terms lookup parameters.
pub fn terms_lookup<S: Into<String>>(
field: S,
index: S,
id: S,
path: S
) -> TermsQuery<TermsLookup>
pub fn terms_lookup<S: Into<String>>(
field: S,
index: S,
id: S,
path: S
) -> TermsQuery<TermsLookup>
Creates an instance of TermsQuery
field
- Field you wish to search.index
- Name of the index from which to fetch field values.id
- ID of the document from which to fetch field values.path
- Name of the field from which to fetch field values. Elasticsearch uses these values as search terms for the query. If the field values include an array of nested inner objects, you can access those objects using dot notation syntax.
pub fn terms_set<I>(
field: impl Into<String>,
terms: I,
minimum_should_match: impl Into<TermsSetMinimumShouldMatch>
) -> TermsSetQuery where
I: IntoIterator,
I::Item: Into<Scalar>,
pub fn terms_set<I>(
field: impl Into<String>,
terms: I,
minimum_should_match: impl Into<TermsSetMinimumShouldMatch>
) -> TermsSetQuery where
I: IntoIterator,
I::Item: Into<Scalar>,
Creates an instance of TermsSetQuery
field
- Field you wish to search.value
- TermsSet you wish to find in the provided field. To return a document, the terms_set must exactly match the field value, including whitespace and capitalization.
Creates an instance of WildcardQuery
field
- Field you wish to search.value
- Wildcard you wish to find in the provided field. To return a document, the wildcard must exactly match the field value, including whitespace and capitalization.
Creates an instance of MatchAllQuery
Creates an instance of MatchNoneQuery
Trait Implementations
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Query
impl UnwindSafe for Query
Blanket Implementations
Mutably borrows from an owned value. Read more