Uses old Rust 2015

0.5.0 Jun 11, 2017
0.4.0 Dec 21, 2016
0.3.2 Sep 22, 2016
0.3.0 Jul 18, 2016
0.1.5 Mar 28, 2016

#3 in #favour

Download history 43/week @ 2024-02-23 7/week @ 2024-03-01 152/week @ 2024-03-29

152 downloads per month

Apache-2.0

5KB

elastic_hyper Latest Version

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 Build Status
Windows Nightly Build status

Documentation

Version Docs
master Documentation
current Documentation

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 the json_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, &params).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, &params,
  &json_str!({
    query: {
      query_string: {
        query: "*"
      }
    }
  })
).unwrap();

No runtime deps