elastification/php-client
Composer 安装命令:
composer require elastification/php-client
包简介
The elastification php client aims to be a very flexible and well performing client to elasticsearch. It supports multiple transports and serializers to maximize it's flexibility.
README 文档
README
ToDo
- Helper for Version response compare. (Symfony/Console)
- singular _alias Put/Post/delete/head (v1,v2?)
- GetFieldMappingRequest (seems to be only in v1 and v2)
- cat api (v1, v2, check if v90)
- repository for cat (implement version check 1 and 2 only)
- analyze (v1, v2, check if v90)
- snapshot (v1, v2, check if v90)
- index recovery (v1, v2, check if v90)
- Think about an array of clients or a decision manager for get the right client (maybe voter pattern?)
- Write documentation
- Create Github Pages
- Check all requests and write down missing here
Changes from Version 1x to 2x
- NodeInfo does not have status in response
- DeleteByQuery is removed
- DeleteMapping is removed
- Index/IndexStats is removed (replaced by index stats)
- Bulk/BulkInsertRequest existing documents having new a subobject under item['error'] response
- Bulk/BulkUpdateRequest existing documents having new a subobject under item['error'] response
Testing
The tests are devided into unit tests and integration tests.
Running the unit tests is simple (composer install is reqired):
bin/phpunit tests/Unit
If you like coder coverage it will be placed in build folder:
bin/phpunit --coverage-html=build tests/Unit
There are also integration test. The subfolders holding version tests. There is a vagrant repository where you can bring all wanted/needed machine alive. [Link is missing]
The phpunit-integration.xml has defined constants for each testable version.
Run integration tests for v2x versions looks like this:
bin/phpunit --coverage-html=build -c phpunit-integration.xml tests/Integration/Request/V2x
Requests Examples
How to check if indexExists:
$indexExistsRequest = new IndexExistsRequest('index', null, $this->serializer); try { $client->send($indexExistsRequest); return true; } catch(ClientException $exception) { return false; }
How to check if indexTypeExists:
$indexTypeExistsRequest = new IndexTypeExistsRequest('index', 'type', $this->serializer); try { $client->send($indexTypeExistsRequest); return true; } catch(ClientException $exception) { return false; }
统计信息
- 总下载量: 8.26k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-08-17