Uses old Rust 2015
0.5.0 |
|
---|---|
0.4.0 |
|
0.3.2 |
|
0.3.0 |
|
0.1.5 |
|
#3 in #favour
152 downloads per month
5KB
elastic_hyper
Provides a synchronous hyper
implementation of the Elasticsearch REST API. The hyper
client is simple to use; there's basically no setup needed besides creating a hyper::Client
object to use for requests. The hyper
client is general-purpose, and suitable for any scenario where on-demand requests are sufficient.
If you'd prefer to call Elasticsearch using a strongly-typed Query DSL builder, see rs-es
.
Build Status
Platform | Channel | Status |
---|---|---|
Linux / OSX | Stable / Nightly | |
Windows | Nightly |
Documentation
Version | Docs |
---|---|
master |
|
current |
Example
The elastic_hyper
client is a thin layer over hyper
; it just maps functions to routes. It's up to the caller to serialise and deserialise HTTP content.
- For query serialisation, the
json_str
crate provides thejson_str!
macro for creating ad-hoc API queries. - For type serialisation / deserialisation, see
elastic_types
.
Currently targeting the master
Elasticsearch branch, aiming for 5.x
.
This will be stabilised through features in the future.
Add elastic_hyper
and json_str
to your Cargo.toml
:
[dependencies]
elastic_hyper = "*"
json_str = "*"
Ping the availability of your cluster:
#[macro_use]
extern crate json_str;
extern crate elastic_hyper as elastic;
let (mut client, params) = elastic::default();
elastic::ping::head(&mut client, ¶ms).unwrap();
A simple query_string
query:
#[macro_use]
extern crate json_str;
extern crate elastic_hyper as elastic;
let (mut client, params) = elastic::default();
let response = elastic::search::post(
&mut client, ¶ms,
&json_str!({
query: {
query_string: {
query: "*"
}
}
})
).unwrap();