elastic_hyper 0.4.0

A lightweight implementation of the Elasticsearch API based on Hyper.
elastic_hyper-0.4.0 doesn't have any documentation.

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();