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.
Cargo.toml
[dependencies]
elastic_reqwest = "*"
elastic_requests = "*"
elastic_responses = "*"
Query your Elasticsearch Cluster, then iterate through the results
// Send a request (omitted, see `samples/basic`, and read the response.
let mut res = client.elastic_req(¶ms, SearchRequest::for_index("_all", body)).unwrap();
//Parse body to JSON as an elastic_responses::Response object
let body_as_json: EsResponse = res.json().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);
}Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)