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

Methods

impl<T> SearchResponseOf<T>
[src]

Returns an Iterator to the search results or hits of the response.

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]

Formats the value using the given formatter.

impl<T: DeserializeOwned> IsOk for SearchResponseOf<T>
[src]

Inspect the http response to determine whether or not it succeeded.