Crate elastic_responses [−] [src]
Elasticsearch Response Iterators
A crate to handle parsing and handling Elasticsearch search results which provides
convenient iterators to step through the results returned. It is designed to work
with elastic-reqwest
.
This crate provides a generic HttpResponse
that can be parsed into a concrete response
type, or an ApiError
.
Usage
Query your Elasticsearch Cluster, then iterate through the results
// Send a request (omitted, see `samples/search`) let http_response = do_request(); // Parse body to JSON as an elastic_responses::SearchResponse object // If the response is an API error then it'll be parsed into a friendly Rust error let body_as_json: SearchResponse = http_response.into_response().unwrap(); // 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); }
Modules
error |
Error types from Elasticsearch |
parse |
Response type parsing. |
Structs
AggregationIterator |
Aggregator that traverses the results from Elasticsearch's Aggregations and returns a result row by row in a table-styled fashion. |
Aggregations |
Type Struct to hold a generic |
BulkErrorsResponse |
Response for a bulk request. |
BulkItem |
A successful bulk response item. |
BulkItemError |
A failed bulk response item. |
BulkItems |
Bulk items split by success or failure. |
BulkResponse |
Response for a bulk request. |
GetResponseOf |
Response for a get document request. |
Hit |
Full metadata and source for a single hit. |
Hits |
Struct to hold the search's Hits, serializable to type |
HttpResponse |
A raw HTTP response with enough information to parse a concrete type from it. |
HttpResponseHead |
The non-body component of the HTTP response. |
PingResponse |
Response for a cluster ping request. |
ReadBody |
A HTTP response body that implements |
SearchResponseOf |
Response for a search request. |
Shards |
Returned hits metadata. |
SliceBody |
A HTTP response body that implements |
Enums
BulkAction |
The bulk action being performed. |
Type Definitions
GetResponse | |
HttpResponseRead | |
HttpResponseSlice | |
SearchResponse |