elastic_responses
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
.
Build Status
Platform | Channel | Status |
---|---|---|
Linux / OSX | Stable / Nightly |
Documentation
Version | Docs |
---|---|
master |
|
current |
Usage
Cargo.toml
[dependencies]
elastic_reqwest = "*"
elastic_responses = "*"
Search
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.unwrap;
// Parse body to JSON
let response = .from_reader.unwrap;
// Use hits() or aggs() iterators
// Hits
for hit in response.hits
// Agregations
for agg in response.aggs
Bulk
Bulk response operations are split by whether they succeeded or failed:
// Send a request (omitted, see `samples/bulk`, and read the response.
let mut res = client.elastic_req.unwrap;
// Parse body to JSON
let response = .from_reader.unwrap;
for op in response.into_iter
License
Licensed under either of these:
- 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)