Struct elastic_responses::SearchResponseOf
[−]
[src]
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>
[src]
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<T: Debug> Debug for SearchResponseOf<T>
[src]
impl<T: DeserializeOwned> IsOk for SearchResponseOf<T>
[src]
fn is_ok<B: ResponseBody>(
head: HttpResponseHead,
body: Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseResponseError>
head: HttpResponseHead,
body: Unbuffered<B>
) -> Result<MaybeOkResponse<B>, ParseResponseError>
Inspect the http response to determine whether or not it succeeded.