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

pub fn new() -> Self

Creates a default search instance

source

pub fn runtime_mapping<S>(self, name: S, mapping: RuntimeMapping) -> Selfwhere S: ToString,

Add runtime mapping to the search request

source

pub fn script_fields<S, T>(self, name: S, script: T) -> Selfwhere S: ToString, T: Into<ScriptField>,

Add script fields to the search request

source

pub fn indices_boost<T, U>(self, field: T, boost: U) -> Selfwhere T: ToString, U: AsPrimitive<f32>,

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).

source

pub fn min_score<F>(self, min_score: F) -> Selfwhere F: Into<f32>,

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

source

pub fn source<S>(self, source: S) -> Selfwhere S: Into<SourceFilter>,

Indicates which source fields are returned for matching documents

source

pub fn stats<S>(self, stats: S) -> Selfwhere S: ToString,

Specific tag of the request for logging and statistical purposes.

source

pub fn from(self, from: u64) -> Self

Starting document offset.

Defaults to 0.

source

pub fn size(self, size: u64) -> Self

The number of hits to return.

Defaults to 10.

source

pub fn query<Q>(self, query: Q) -> Selfwhere Q: Into<Query>,

Defines the search definition using the Query DSL.

source

pub fn post_filter<Q>(self, post_filter: Q) -> Selfwhere Q: Into<Query>,

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.

source

pub fn sort<T>(self, sort: T) -> Selfwhere T: IntoIterator, T::Item: Into<Sort>,

A collection of sorting fields

source

pub fn track_total_hits<T>(self, track_total_hits: T) -> Selfwhere T: Into<TrackTotalHits>,

Track total hits

source

pub fn highlight<H>(self, highlight: H) -> Selfwhere H: Into<Highlight>,

Highlight

source

pub fn rescore<T>(self, rescore: T) -> Selfwhere T: IntoIterator, T::Item: Into<Rescore>,

Rescore

source

pub fn suggest<T, U>(self, name: T, suggester: U) -> Selfwhere T: ToString, U: Into<Suggester>,

Suggest

source

pub fn stored_fields<T>(self, stored_fields: T) -> Selfwhere T: Into<StoredFields>,

A collection of stored fields

source

pub fn docvalue_fields<T>(self, docvalue_fields: T) -> Selfwhere T: IntoIterator, T::Item: ToString,

A collection of docvalue fields

source

pub fn pit(self, pit: PointInTime) -> Self

Point in time

source

pub fn search_after<T>(self, sort_values: T) -> Selfwhere T: Into<Terms>,

Search after a set of sort values.

source

pub fn timeout<T>(self, timeout: T) -> Selfwhere T: Into<Time>,

parameter to specify a duration you’d like to wait on each shard to complete.

https://www.elastic.co/guide/en/elasticsearch/reference/8.9/search-your-data.html#search-timeout

source

pub fn aggregate<N, A>(self, aggregation_name: N, aggregation: A) -> Selfwhere N: Into<AggregationName>, A: Into<Aggregation>,

Pushes aggregation

Trait Implementations§

source§

fn clone(&self) -> Search

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

fn default() -> Search

Returns the “default value” for a type. Read more
source§

fn eq(&self, other: &Search) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.