{"id":23277651,"url":"https://github.com/fork/craft-elastica","last_synced_at":"2025-08-21T10:32:26.537Z","repository":{"id":56848242,"uuid":"327004279","full_name":"fork/craft-elastica","owner":"fork","description":"A plugin to connect to Elasticsearch and persist elements via hooks","archived":false,"fork":false,"pushed_at":"2024-11-12T15:47:58.000Z","size":99,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"develop","last_synced_at":"2024-11-12T16:40:42.231Z","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":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fork.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-05T13:17:34.000Z","updated_at":"2024-10-08T16:15:12.000Z","dependencies_parsed_at":"2024-10-18T06:41:31.305Z","dependency_job_id":null,"html_url":"https://github.com/fork/craft-elastica","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"638730ee98836492711a7d2d1a597f1e7eae3939"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-elastica","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-elastica/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-elastica/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fork%2Fcraft-elastica/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fork","download_url":"https://codeload.github.com/fork/craft-elastica/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230501081,"owners_count":18236057,"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-12-19T22:13:38.826Z","updated_at":"2025-08-21T10:32:26.505Z","avatar_url":"https://github.com/fork.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"left\"\u003e\n  \u003cimg width=\"600\" title=\"Craft Elastica\" src=\"resources/img/plugin-logo.png\" alt=\"Fork Logo\" /\u003e\n\u003c/div\u003e\n\n# Elastica Plugin for Craft 5.x\n\n**Table of contents**\n\n- [Features](#features)\n- [Requirements](#requirements)\n- [Setup](#setup)\n- [Usage](#usage)\n- [Roadmap](#roadmap)\n\n\u003c!-- /TOC --\u003e\n\n---\n\n## Features\n\n- Index entries and other elements in Elasticsearch\n- Customize Index data structures via hooks  \n- Define Index Templates to configure the Index and its fields and mapping in Elasticsearch\n- Re-Index contents via utility or console command\n\n## Requirements\n\n- Craft CMS \u003e= 5.x\n\n### Version Matrix\n\n| Elastica Version | Craft Version | ElasticSearch Version |\n|------------------|---------------|-----------------------|\n| 4.x              | 5.x           | 8.x                   |\n| 3.x              | 5.x           | 7.x                   |\n| 2.x              | 4.x           | 7.x                   |\n\n## Setup\n\n**1. Install**\n\nInstall the package\n\n```sh\ncd /path/to/project\ncomposer require fork/craft-elastica\n```\n\n**2. Configuration**\n\nGo to the plugin settings page and enter a index prefix name which is prepended to the indexes being created in Elasticsearch.\nThe name of the index is generated from this prefix.\nAlso provide the hostname of the elasticsearch instance.\n\n## Usage\n\nTo generate the data to index register event handlers in your own module or plugin class like this:\n\n```php\n// initialize elasticsearch indexer\nEvent::on(\n   Indexer::class,\n   Indexer::EVENT_INDEXER_INIT,\n   function (IndexerInitEvent $event) {\n       $event-\u003eaddSectionHandles([\n           'articles',\n       ]);\n       $event-\u003eaddCategoryGroupHandles([\n           'topics',\n       ]);\n       $event-\u003eaddVolumeHandles([\n           'images',\n       ]);\n   }\n);\n// build elasticsearch index data\nEvent::on(\n   Indexer::class,\n   Indexer::EVENT_BEFORE_INDEX_DATA,\n   function (IndexEvent $event) {\n       // build your custom data structure to index\n       $indexData = MyCustomPlugin::$plugin-\u003emySearchService-\u003egetIndexData($event-\u003esender);\n       $event-\u003eindexData = $indexData;\n   }\n);\n```\n\n## Environment based configuration\n\nYou can make the plugin's configuration environment based by adding an elastica.php file in your config directory with\nthe following contents. This is just an example, you can name your environment variables as you want.\n\n```php\nuse craft\\helpers\\App;\n\nreturn [\n    'indexingEnabled' =\u003e App::env('ELASTICSEARCH_INDEXING_ENABLED') ?? true,\n    'hosts' =\u003e [\n        [\n            App::env('CRAFT_ENVIRONMENT'),\n            App::env('ELASTICSEARCH_URL'),\n            App::env('ELASTICSEARCH_INDEX_PREFIX'),\n        ]\n    ]\n];\n```\n\n## Roadmap\n\n- [x] Logo\n- [x] Index categories\n- [ ] Maybe include search proxy\n- [ ] Exclude sites via settings\n- [ ] Show index info / test index in utility\n- [ ] More documentation\n\n---\n\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"resources/img/heart.png\" width=\"38\" height=\"41\" alt=\"Made with love by Fork\" /\u003e\n\n  \u003cp\u003eBrought to you by \u003ca href=\"https://www.fork.de\"\u003eFork Unstable Media GmbH\u003c/a\u003e\u003c/p\u003e\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffork%2Fcraft-elastica","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffork%2Fcraft-elastica","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffork%2Fcraft-elastica/lists"}