dev-master
9999999-devElastica manager for creating, rotating, populating and managing ElasticSearch indexes using Elastica client library
MIT
The Requires
- php >=5.3.0
- ruflin/elastica >=v0.90.1.0
by Kaspars Sprogis
elasticsearch manager elastica
Wallogit.com
2017 © Pedro Peláez
Elastica manager for creating, rotating, populating and managing ElasticSearch indexes using Elastica client library
FF-Elastica-Manager is php library for creating, rotating, populating and managing ElasticSearch indexes using Elastica client library., (*1)
This package is still under development, however these features are already implemented, (*2)
Todo: Index copy/clone, index rotate (copy and change alias), Symfony2 Console component commands, (*3)
The recommended way to install package is through composer. Create a composer.json in your project root-directory:, (*4)
{
"require": {
"darklow/ff-elastica-manager": "*"
}
}
and run curl -s http://getcomposer.org/installer | php to get composer or run php composer.phar install to install package, (*5)
ElasticaManager package contains of following classes:, (*6)
For every index you want to manage, you have to create two classes:, (*7)
Configuration - Configuration class which provides necessary info for ElasticSearch index:, (*8)
_all => [ enabled => false] and so onDataProvider - Data provider class which provides all the data needed to populate whole index or just one document. Following methods must be implemented:, (*9)
Example of both classes can be found in example directory, (*10)
When you have setup up everything, working with indexes is really easy:, (*11)
<?php
// Get IndexManager
$shopIndexManager = $elasticaManager->getIndexManager('shop');
// Use IndexManager
$shopIndexManager->create();
$shopIndexManager->populate();
$shopIndexManager->updateDocument(1);
$shopIndexManager->delete();
Every time you create index, your configuration and mappings are used and once populated your data is in the index., (*12)
<?php
// Get IndexManager
$shopIndexManager = $elasticaManager->getIndexManager('shop');
// Get iterator instance
$iterator = $shopIndexManager->getIterator();
// Specify query
$query = new Elastica\Query(new Elastica\Query\MatchAll());
// Define closure
$closure = function (DataProviderDocument $doc, $i, $total) {
// Do whatever you like with $doc->getData()
};
// Start iterating
$iterator->iterate($query, $closure);
Read more on how to setup initial classes in documentation., (*13)
Read full documentation on how to initiate and use ElasticaManager and IndexManager here:, (*14)
Documentation wiki, (*15)
'FF-Elastica-Manager' is licensed under the MIT license., (*16)
Elastica manager for creating, rotating, populating and managing ElasticSearch indexes using Elastica client library
MIT
elasticsearch manager elastica