pub struct Search { /* private fields */ }
Expand description
Returns search hits that match the query defined in the request.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html
Implementations§
Source§impl Search
impl Search
Sourcepub fn runtime_mapping<S>(self, name: S, mapping: RuntimeMapping) -> Selfwhere
S: ToString,
pub fn runtime_mapping<S>(self, name: S, mapping: RuntimeMapping) -> Selfwhere
S: ToString,
Add runtime mapping to the search request
Sourcepub fn script_fields<S, T>(self, name: S, script: T) -> Self
pub fn script_fields<S, T>(self, name: S, script: T) -> Self
Add script fields to the search request
Sourcepub fn indices_boost<T, U>(self, field: T, boost: U) -> Self
pub fn indices_boost<T, U>(self, field: T, boost: U) -> Self
Allows to configure different boost level per index when searching across more than one indices. This is very handy when hits coming from one index matter more than hits coming from another index (think social graph where each user has an index).
Sourcepub fn min_score<F>(self, min_score: F) -> Self
pub fn min_score<F>(self, min_score: F) -> Self
Exclude documents which have a _score
less than the minimum specified
in min_score
Note, most times, this does not make much sense, but is provided for advanced use cases
Sourcepub fn source<S>(self, source: S) -> Selfwhere
S: Into<SourceFilter>,
pub fn source<S>(self, source: S) -> Selfwhere
S: Into<SourceFilter>,
Indicates which source fields are returned for matching documents
Sourcepub fn stats<S>(self, stats: S) -> Selfwhere
S: ToString,
pub fn stats<S>(self, stats: S) -> Selfwhere
S: ToString,
Specific tag
of the request for logging and statistical purposes.
Sourcepub fn post_filter<Q>(self, post_filter: Q) -> Self
pub fn post_filter<Q>(self, post_filter: Q) -> Self
When you use the post_filter
parameter to filter search results, the search hits are filtered after the
aggregations are calculated. A post filter has no impact on the aggregation results.
Sourcepub fn track_total_hits<T>(self, track_total_hits: T) -> Selfwhere
T: Into<TrackTotalHits>,
pub fn track_total_hits<T>(self, track_total_hits: T) -> Selfwhere
T: Into<TrackTotalHits>,
Track total hits
Sourcepub fn track_scores(self, enabled: bool) -> Self
pub fn track_scores(self, enabled: bool) -> Self
If true, calculate and return document scores, even if the scores are not used for sorting.
Sourcepub fn stored_fields<T>(self, stored_fields: T) -> Selfwhere
T: Into<StoredFields>,
pub fn stored_fields<T>(self, stored_fields: T) -> Selfwhere
T: Into<StoredFields>,
A collection of stored fields
Sourcepub fn docvalue_fields<T>(self, docvalue_fields: T) -> Self
pub fn docvalue_fields<T>(self, docvalue_fields: T) -> Self
A collection of docvalue fields
Sourcepub fn pit(self, pit: PointInTime) -> Self
pub fn pit(self, pit: PointInTime) -> Self
Point in time
Sourcepub fn search_after<T>(self, sort_values: T) -> Self
pub fn search_after<T>(self, sort_values: T) -> Self
Search after a set of sort values.
Sourcepub fn timeout<T>(self, timeout: T) -> Self
pub fn timeout<T>(self, timeout: T) -> Self
parameter to specify a duration you’d like to wait on each shard to complete.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-your-data.html#search-timeout
Sourcepub fn knn(self, knn: Knn) -> Self
pub fn knn(self, knn: Knn) -> Self
Defines the kNN query to run.
https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html#search-api-knn
Sourcepub fn collapse<C>(self, collapse: C) -> Self
pub fn collapse<C>(self, collapse: C) -> Self
Parameter to specify collapsing results on some field
https://www.elastic.co/guide/en/elasticsearch/reference/current/collapse-search-results.html
Sourcepub fn extra(self, extra: BTreeMap<String, Value>) -> Self
pub fn extra(self, extra: BTreeMap<String, Value>) -> Self
Extra fields for something not yet supported.
Search::new()
.size(10)
.extra([
(
"knn".to_owned(),
json!({ "field": "abc" }),
),
(
"terminate_after".to_owned(),
json!(42)
),
].into());