{"id":17002903,"url":"https://github.com/darklow/ff-elastica-manager","last_synced_at":"2026-03-17T18:38:08.379Z","repository":{"id":5161486,"uuid":"6331697","full_name":"darklow/ff-elastica-manager","owner":"darklow","description":"Elastica manager for creating, rotating, populating and managing ElasticSearch indexes using Elastica client library","archived":false,"fork":false,"pushed_at":"2013-11-19T06:38:06.000Z","size":713,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T06:21:53.714Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"infinispan/infinispan","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darklow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-10-22T08:26:31.000Z","updated_at":"2015-06-10T06:05:05.000Z","dependencies_parsed_at":"2022-07-05T21:32:55.713Z","dependency_job_id":null,"html_url":"https://github.com/darklow/ff-elastica-manager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklow%2Fff-elastica-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklow%2Fff-elastica-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklow%2Fff-elastica-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklow%2Fff-elastica-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darklow","download_url":"https://codeload.github.com/darklow/ff-elastica-manager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249419775,"owners_count":21268697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-14T04:29:19.508Z","updated_at":"2026-03-17T18:38:03.356Z","avatar_url":"https://github.com/darklow.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"FF-Elastica-Manager\n================\n\nFF-Elastica-Manager is php library for creating, rotating, populating and managing ElasticSearch indexes using [Elastica client](https://github.com/ruflin/Elastica) library.\n\n### Work in progress\n\nThis package is still under development, however these features are already implemented\n\n## Features\n\n* Index creation with user config and mapping\n* Index data population using data provider\n* One document update/insert/delete\n* Index utils: delete, indexExists, addAlias, removeAlias\n* Iterator. Batch iterator iterates through index data (using ES scan/scroll functionality) and performs user specified closure\n* Examples: ShopConfiguration.php, ShopDataProvider.php [Go to example directory](https://github.com/darklow/ff-elastica-manager/tree/master/example)\n\n**Todo**: Index copy/clone, index rotate (copy and change alias), Symfony2 Console component commands\n\n## Installation\nThe recommended way to install package is [through composer](http://getcomposer.org). Create a `composer.json` in your project root-directory:\n\n    {\n        \"require\": {\n            \"darklow/ff-elastica-manager\": \"*\"\n        }\n    }\n\nand run ```curl -s http://getcomposer.org/installer | php``` to get composer or run ```php composer.phar install``` to install package\n\n\n## Overview\n\nElasticaManager package contains of following classes:\n\n1. **ElasticaManager** - working with indexes and elasticsearch server\n2. **IndexManager** - create, delete, manage specific index\n3. **Batch Iterator** - iterates through index data (using ES scan/scroll functionality) and performs user specified closure\n\nFor every index you want to manage, you have to create two classes:\n\n1. **Configuration** - Configuration class which provides necessary info for ElasticSearch index:\n    * Index default name - default name of the index (can be overridden on IndexManager initiation)\n    * Index default alias name\n    * Index types - ElasticSearch index type name(s)\n    * Index configuration - number of shards and replicas, analysis analyzers and filters\n    * Mapping properties - fields and its types for each/all ElasticSearch type\n    * Mapping params - params like ```_all =\u003e [ enabled =\u003e false]``` and so on\n\n\n2. **DataProvider** - Data provider class which provides all the data needed to populate whole index or just one document.\nFollowing methods must be implemented:\n    * getData($typeName = null) - Method must return iterable result/array for all the data or one type only if specified\n    * iterationRowTransform($data, $typeName = null) - Method must convert iteration row data to DataProviderDocument object which contains three variables\n        * id - DocumentID\n        * typeName - ElasticSearch index type name\n        * data - Array for document source data\n    * getTotal($typeName = null) - Optional method. Must return count for all the data or one type only if specified used. Used for iteration closures.\n    * getIterationClosure() - Optional method. Must return callback for iteration: function ($i, $total)\n    * getDocumentData() - Method must return same type of data as one iteration row in getData()\n\nExample of both classes can be found in [example directory](https://github.com/darklow/ff-elastica-manager/tree/master/example)\n\nWhen you have setup up everything, working with indexes is really easy:\n\n### IndexManager Example\n\n```php\n\u003c?php\n// Get IndexManager\n$shopIndexManager = $elasticaManager-\u003egetIndexManager('shop');\n\n// Use IndexManager\n$shopIndexManager-\u003ecreate();\n$shopIndexManager-\u003epopulate();\n$shopIndexManager-\u003eupdateDocument(1);\n$shopIndexManager-\u003edelete();\n```\n\nEvery time you create index, your configuration and mappings are used and once populated your data is in the index.\n\n### Batch iterator Example\n\n```php\n\u003c?php\n// Get IndexManager\n$shopIndexManager = $elasticaManager-\u003egetIndexManager('shop');\n\n// Get iterator instance\n$iterator = $shopIndexManager-\u003egetIterator();\n\n// Specify query\n$query = new Elastica\\Query(new Elastica\\Query\\MatchAll());\n\n// Define closure\n$closure = function (DataProviderDocument $doc, $i, $total) {\n\t// Do whatever you like with $doc-\u003egetData()\n};\n\n// Start iterating\n$iterator-\u003eiterate($query, $closure);\n```\n\nRead more on how to setup initial classes in documentation.\n\n## Documentation\n\nRead full documentation on how to initiate and use ElasticaManager and IndexManager here:\n\n[Documentation wiki](https://github.com/darklow/ff-elastica-manager/wiki)\n\n\n## License\n\n'FF-Elastica-Manager' is licensed under the MIT license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarklow%2Fff-elastica-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarklow%2Fff-elastica-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarklow%2Fff-elastica-manager/lists"}