pub struct SearchResponse<T> {
pub total: u64,
pub max_score: Option<f32>,
pub hits: Vec<Hit<T>>,
pub took: Duration,
pub timed_out: bool,
pub shards: ShardStats,
}Expand description
A page of search results.
Fields§
§total: u64Total matches across the whole index, not the page size.
max_score: Option<f32>The top score in this page, if scored.
hits: Vec<Hit<T>>The hits in this page.
took: DurationHow long OpenSearch reported the query took.
timed_out: booltrue when OpenSearch hit its time budget and returned partial
results — the hits are whatever completed in time, not the full match
set. The HTTP status is still 200.
shards: ShardStatsPer-shard execution tally. A non-zero ShardStats::failed means some
shards errored and their matches are missing from hits — again
with a 200 status.
Implementations§
Source§impl<T> SearchResponse<T>
impl<T> SearchResponse<T>
Sourcepub fn is_partial(&self) -> bool
pub fn is_partial(&self) -> bool
true when this page is incomplete — it timed out or some shards
failed — so hits/total under-report the real match set. A healthy
full response is false.
Source§impl<T> SearchResponse<T>where
T: DeserializeOwned,
impl<T> SearchResponse<T>where
T: DeserializeOwned,
Sourcepub fn from_value(value: Value) -> Result<Self>
pub fn from_value(value: Value) -> Result<Self>
Decode an OpenSearch _search response body into a typed page.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for SearchResponse<T>
impl<T> RefUnwindSafe for SearchResponse<T>where
T: RefUnwindSafe,
impl<T> Send for SearchResponse<T>where
T: Send,
impl<T> Sync for SearchResponse<T>where
T: Sync,
impl<T> Unpin for SearchResponse<T>where
T: Unpin,
impl<T> UnsafeUnpin for SearchResponse<T>
impl<T> UnwindSafe for SearchResponse<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more