elastification/php-client

elastification php 客户端旨在成为一个非常灵活且性能良好的 Elasticsearch 客户端。它支持多种传输和序列化方式,以最大化其灵活性。

0.14.2 2016-03-30 08:49 UTC

README

Build Status Scrutinizer Code Quality Code Coverage Dependency Status

Latest Stable Version Total Downloads Latest Unstable Version License

SensioLabsInsight

待办事项

  • 版本响应比较的辅助器。(Symfony/Console)
  • 单一_alias Put/Post/delete/head (v1,v2?)
  • GetFieldMappingRequest (似乎仅在 v1 和 v2 中存在)
  • cat api (v1, v2, 检查是否为 v90)
  • cat 的仓库(仅实现版本检查 1 和 2)
  • analyze (v1, v2, 检查是否为 v90)
  • snapshot (v1, v2, 检查是否为 v90)
  • 索引恢复(v1, v2, 检查是否为 v90)
  • 考虑使用客户端数组或决策管理器来获取正确的客户端(可能是投票模式?)
  • 编写文档
  • 创建 Github Pages
  • 检查所有请求并在此处记录缺失的请求

从版本 1x 到 2x 的变更

  • NodeInfo 响应中没有状态
  • DeleteByQuery 已移除
  • DeleteMapping 已移除
  • Index/IndexStats 已移除(由索引统计信息替换)
  • Bulk/BulkInsertRequest 现有文档在 item['error'] 响应下有新的子对象
  • Bulk/BulkUpdateRequest 现有文档在 item['error'] 响应下有新的子对象

测试

测试分为单元测试和集成测试。

运行单元测试很简单(需要 composer install)

    bin/phpunit tests/Unit

如果你喜欢代码覆盖率,它将被放置在构建文件夹中

    bin/phpunit --coverage-html=build tests/Unit

还有集成测试。包含版本测试的子文件夹。有一个 vagrant 仓库,你可以在其中启动所有想要的/需要的机器。[链接缺失]

phpunit-integration.xml 为每个可测试版本定义了常量。

运行 v2x 版本的集成测试看起来像这样

    bin/phpunit --coverage-html=build -c phpunit-integration.xml tests/Integration/Request/V2x

请求示例

如何检查索引是否存在

$indexExistsRequest = new IndexExistsRequest('index', null, $this->serializer);

try {
    $client->send($indexExistsRequest);
    return true;
} catch(ClientException $exception) {
    return false;
}

如何检查索引类型是否存在

$indexTypeExistsRequest = new IndexTypeExistsRequest('index', 'type', $this->serializer);

try {
    $client->send($indexTypeExistsRequest);
    return true;
} catch(ClientException $exception) {
    return false;
}