Download the PHP package novaway/elasticsearch-client without Composer
On this page you can find all versions of the php package novaway/elasticsearch-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download novaway/elasticsearch-client
More information about novaway/elasticsearch-client
Files in novaway/elasticsearch-client
Package elasticsearch-client
Short Description A lightweight PHP client for Elasticsearch
License MIT
Informations about the package elasticsearch-client
Novaway ElasticSearch Client
Note : this project is discontinued in favor of the ElasticsearchBundle, as it was more or less trying to do what elastica does already well
A lightweight PHP 7.0+ client for Elasticsearch, providing features over Elasticsearch-PHP
Compatibility
This branch is tested and compatible with ElasticSearch 6.*
The compatibility with ElasticSearch 5.* is supported, and should work, but is to be considered hazardous.
Installation
Install using composer:
Usage
Create an index
The first thing you'll need to do to use this library is to instatiate an index. This will be the keystone of the client.
Index an object
In order to be searched, objects should be indexed as a serialized version. In order to be indexed, Object should implement \Novaway\ElasticsearchClient\Indexable
interface.
By default, objects are serialized with Elasticsearch-PHP's SmartSerializer, but you can choose to use a custom serializer.
Remove an object from index
To remove an object from the index, the process is still
Search the index
Basic match query
First, create a QueryExecutor
.
Use the QueryBuilder
to build your query and execute it.
The QueryBuilder
allow you to define a limit and an offset for a search result, and choose the minimum score to display.
Advanced Querying
This client provide several ways to improve querying :
- Filtering (missing documentation)
- Aggregations
- Result Formating (missing documentation)
Clear the index
You might want, for some reason, to purge an index. The reload
method drops and recreates the index.
Hotswapping
You will want to reindex all your data sometimes.
It is possible to do it without downtime using the hotswap mechanisme
Recommended usage with Symfony
If you are using this library in a symfony project, we recommend to use it as service.
Then you'll only have to work with the myapp.search.object_indexer
and myapp.search.query_executor
services.
Testing
A testing environment is provided using a dockerized version of elasticsearch.
Testing is done using the Atoum framework for unit testing and the Behat framework for behavior testing.
A Makefile
provide useful commands for testing, so you can run the full test suite by running :
License
This library is published under MIT license
All versions of elasticsearch-client with dependencies
elasticsearch/elasticsearch Version ^5.2 || ^6.0
symfony/dependency-injection Version ^3.0 || ^4.0
myclabs/php-enum Version ^1.0