eos / elasticsearch-6-connector
An abstract php connector for elasticsearch 6
Installs: 3 727
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 6
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- elasticsearch/elasticsearch: ^6.0
This package is auto-updated.
Last update: 2024-10-25 08:23:14 UTC
README
An abstract php connector for elasticsearch 6.
composer require eos/elasticsearch-6-connector
How to use?
This library provides abstract classes with base functionalities.
Your domain classes (e.g. repositories, event handlers or command processors) should extend the AbstractConnector
or, if you want to use parallel indices, the AbstractParallelIndexConnector
.
Method provided by abstract classes
All methods are defined as protected and designed for internal usage in your extending class.
AbstractConnector
:
AbstractParallelIndexConnector
:
Dependencies
The AbstractConnector
requires an instance of ConnectionFactoryInterface
and an instance of IndexDefinerInterface
(AbstractParallelIndexConnector
instead requires ParellelIndexDefinerInterface
).
Optional you can provide a bulkSize
. If the bulkSize
, which is 0 by default, is greater then 1, bulk requests with
the given bulk size will be executed instead of single requests for each storage operation.
ConnectionFactoryInterface
The connection factory is responsible for creating instances of Elasticsearch\Client
.
The provided implementation of ConnectionFactoryInterface
is SimpleConnectionFactory
, which will take a single (!)
dsn
(scheme://host:port
) as constructor argument.
IndexDefinerInterface
Index definers provide methods, which contains/creates the elasticsearch definition of a specific index.
An index definer can provide more then one index definition but only one for each type.
Following the best practices for elasticsearch >= 6 each type will stored in its own index.
If you want to use one index definer for each type, your index definers could extend AbstractIndexDefiner
and can be added
to an instance of IndexDefinerRegistry
.
If you want to prefix all your index names, you could wrap the IndexDefinerRegistry
into an instance of PrefixedIndexDefiner
(its also possible to wrap each single index definer into its own PrefixedIndexDefiner
).