pub struct MultiSearch<U> { /* private fields */ }Expand description
A typed query across every index of a FlussoMultiDocument union — the
blended counterpart of Search, with the same clause
builder and the same client-free shape.
Hits come back in one relevance-ranked list; from/size page that
blended list, not each index. Terminals: send for a typed
page of union values, count for the total matches across
all the indexes.
Implementations§
Source§impl<U: FlussoMultiDocument> MultiSearch<U>
impl<U: FlussoMultiDocument> MultiSearch<U>
Sourcepub fn new() -> Self
pub fn new() -> Self
Start a query across the union’s indexes (usually via
FlussoMultiDocument::query).
Sourcepub fn query(self, query: impl AsQuery<Root>) -> Self
pub fn query(self, query: impl AsQuery<Root>) -> Self
A scoring clause (bool.must). Root-scope queries from any of the
union’s document types compose here; a field unmapped in one index
simply doesn’t match there. An absent clause adds nothing.
Sourcepub fn filter(self, query: impl AsQuery<Root>) -> Self
pub fn filter(self, query: impl AsQuery<Root>) -> Self
A non-scoring, cacheable clause (bool.filter). An absent clause adds
nothing — so filter(opt.map(|v| handle.eq(v))) is a conditional filter.
Sourcepub fn must_not(self, query: impl AsQuery<Root>) -> Self
pub fn must_not(self, query: impl AsQuery<Root>) -> Self
An exclusion clause (bool.must_not). An absent clause excludes nothing.
Sourcepub fn should(self, query: impl AsQuery<Root>) -> Self
pub fn should(self, query: impl AsQuery<Root>) -> Self
An optional, scoring clause (bool.should). An absent clause adds nothing.
Sourcepub fn sort(self, sort: Sort) -> Self
pub fn sort(self, sort: Sort) -> Self
Append a sort key. It applies to the blended list, so the field
must exist in every index of the union (or carry an unmapped_type in
its options) — OpenSearch rejects a sort on a field one index lacks.
Relevance (no sort) is always safe.
Sourcepub fn sorts(self, sorts: impl IntoIterator<Item = Sort>) -> Self
pub fn sorts(self, sorts: impl IntoIterator<Item = Sort>) -> Self
Append several sort keys at once — e.g. from a
SortBuilder. Equivalent to repeated sort.
Sourcepub fn size(self, size: u64) -> Self
pub fn size(self, size: u64) -> Self
Maximum number of hits to return, across all the indexes combined.
Sourcepub fn raw(self, query: Value) -> Self
pub fn raw(self, query: Value) -> Self
Replace the query body with a raw OpenSearch query DSL value. The
pressure-release valve, as on Search; hits still
decode into the union.
Sourcepub fn physical_path(&self) -> &str
pub fn physical_path(&self) -> &str
The comma-joined physical index list this query addresses — one
{index}_{hash} per union variant. For logging and debugging.
Sourcepub fn body(&self) -> Value
pub fn body(&self) -> Value
The request body this search will POST to _search. Pure — useful for
tests and debugging.
Sourcepub fn count_body(&self) -> Value
pub fn count_body(&self) -> Value
The request body count will POST to _count: just
the query (as on Search::count_body).
Sourcepub async fn send(&self, client: &Client) -> Result<SearchResponse<U>>
pub async fn send(&self, client: &Client) -> Result<SearchResponse<U>>
Execute the search and decode the blended hits into the union.
Trait Implementations§
Source§impl<U: Clone> Clone for MultiSearch<U>
impl<U: Clone> Clone for MultiSearch<U>
Source§fn clone(&self) -> MultiSearch<U>
fn clone(&self) -> MultiSearch<U>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more