#hyper-client #elasticsearch #synchronous #deprecated #api #elastic #favour

已删除 elastic_hyper

废弃以支持 elastic_reqwest

使用旧Rust 2015

0.5.0 2017年6月11日
0.4.0 2016年12月21日
0.3.2 2016年9月22日
0.3.0 2016年7月18日
0.1.5 2016年3月28日

#3#favour

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

每月下载 152次

Apache-2.0

5KB

elastic_hyper 最新版本

提供Elasticsearch REST API的同步hyper实现。使用hyper客户端很简单;基本上不需要设置,只需创建一个用于请求的hyper::Client对象即可。该hyper客户端是通用型的,适用于任何需要即时请求的场景。

如果您希望使用强类型查询DSL构建器调用Elasticsearch,请参阅rs-es

构建状态

平台 频道 状态
Linux / OSX 稳定版 / 夜间版 Build Status
Windows 夜间版 Build status

文档

版本 文档
master Documentation
当前 Documentation

示例

elastic_hyper客户端是在hyper之上的一个薄层;它只是将函数映射到路由。序列化和反序列化HTTP内容由调用者负责。

  • 对于查询序列化,json_str包提供了用于创建临时API查询的json_str!宏。
  • 对于类型序列化和反序列化,请参阅elastic_types

目前针对Elasticsearch的master分支,目标是5.x。这将在未来的功能中得到稳定化。

elastic_hyperjson_str添加到您的Cargo.toml

[dependencies]
elastic_hyper = "*"
json_str = "*"

检查集群的可用性

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

简单的query_string查询

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

无运行时依赖