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.
Installs: 8 254
Dependents: 1
Suggesters: 0
Security: 0
Stars: 7
Watchers: 5
Forks: 2
Open Issues: 0
Requires
- php: >=5.5.0
- psr/log: ~1.0
Requires (Dev)
- guzzlehttp/guzzle: >=6.0,<7.0
- jms/serializer: ~0.15
- munkie/elasticsearch-thrift-php: ~1.4
- phpunit/phpunit: ~4.8
Suggests
- guzzlehttp/guzzle: Needed for HttpGuzzle transport
- jms/serializer: Needed for serialization of entities
- munkie/elasticsearch-thrift-php: Needed for thrift transport
This package is not auto-updated.
Last update: 2024-11-23 15:18:48 UTC
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; }