Struct elastic::client::responses::SearchResponseOf
[−]
pub struct SearchResponseOf<T> { pub took: u64, pub timed_out: bool, pub shards: Shards, pub hits: Hits<T>, pub aggregations: Option<Aggregations>, pub status: Option<u16>, }
Response for a search request.
This is the main struct
of the crate, provides access to the hits
and aggs
iterators.
Examples
// Send a request (omitted, see `samples/basic`), and read the response. // Parse body to JSON as an elastic_responses::SearchResponse object let body_as_json: SearchResponse = do_request(); // Use hits() or aggs() iterators // Hits for i in body_as_json.hits() { println!("{:?}",i); } // Agregations for i in body_as_json.aggs() { println!("{:?}",i); }
Fields
took: u64
timed_out: bool
hits: Hits<T>
aggregations: Option<Aggregations>
status: Option<u16>
Methods
impl<T> SearchResponseOf<T>
fn hits(&self) -> &[T]
Returns an Iterator to the search results or hits of the response.
fn aggs(&self) -> &Aggregations
Returns an Iterator to the search results or aggregations part of the response.
This Iterator transforms the tree-like JSON object into a row/table based format for use with standard iterator adaptors.
Trait Implementations
impl<'de, T> Deserialize<'de> for SearchResponseOf<T> where
T: Deserialize<'de>,
T: Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<SearchResponseOf<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
__deserializer: __D
) -> Result<SearchResponseOf<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
impl<T> IsOk for SearchResponseOf<T> where
T: DeserializeOwned,
T: DeserializeOwned,
fn is_ok<B>(
head: HttpResponseHead,
body: Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseResponseError> where
B: ResponseBody,
head: HttpResponseHead,
body: Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseResponseError> where
B: ResponseBody,
Inspect the http response to determine whether or not it succeeded.
impl<T> Debug for SearchResponseOf<T> where
T: Debug,
T: Debug,