PHPackages                             fork/craft-elastica - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Search &amp; Filtering](/categories/search)
4. /
5. fork/craft-elastica

ActiveCraft-plugin[Search &amp; Filtering](/categories/search)

fork/craft-elastica
===================

A plugin to connect to Elasticsearch and persist elements via hooks

5.0.0(9mo ago)102.0k↓41.7%1MITPHPPHP ^8.2

Since Jan 5Pushed 9mo ago8 watchersCompare

[ Source](https://github.com/fork/craft-elastica)[ Packagist](https://packagist.org/packages/fork/craft-elastica)[ RSS](/packages/fork-craft-elastica/feed)WikiDiscussions develop Synced 1w ago

READMEChangelog (6)Dependencies (5)Versions (19)Used By (0)

 [![Fork Logo](resources/img/plugin-logo.png "Craft Elastica")](resources/img/plugin-logo.png)

Elastica Plugin for Craft 5.x
=============================

[](#elastica-plugin-for-craft-5x)

**Table of contents**

- [Features](#features)
- [Requirements](#requirements)
- [Setup](#setup)
- [Usage](#usage)
- [Roadmap](#roadmap)

---

Features
--------

[](#features)

- Index entries and other elements in Elasticsearch
- Customize Index data structures via hooks
- Define Index Templates to configure the Index and its fields and mapping in Elasticsearch
- Re-Index contents via utility or console command

Requirements
------------

[](#requirements)

- Craft CMS &gt;= 5.x

### Version Matrix

[](#version-matrix)

Elastica VersionCraft VersionElasticSearch VersionHint5.x5.x8.xUses new index template format4.x5.x8.xUses deprecated index template format3.x5.x7.x2.x4.x7.xSetup
-----

[](#setup)

**1. Install**

Install the package

```
cd /path/to/project
composer require fork/craft-elastica
```

**2. Configuration**

Go to the plugin settings page and enter a index prefix name which is prepended to the indexes being created in Elasticsearch. The name of the index is generated from this prefix. Also provide the hostname of the elasticsearch instance.

Usage
-----

[](#usage)

To generate the data to index register event handlers in your own module or plugin class like this:

```
// initialize elasticsearch indexer
Event::on(
   Indexer::class,
   Indexer::EVENT_INDEXER_INIT,
   function (IndexerInitEvent $event) {
       $event->addSectionHandles([
           'articles',
       ]);
       $event->addCategoryGroupHandles([
           'topics',
       ]);
       $event->addVolumeHandles([
           'images',
       ]);
   }
);
// build elasticsearch index data
Event::on(
   Indexer::class,
   Indexer::EVENT_BEFORE_INDEX_DATA,
   function (IndexEvent $event) {
       // build your custom data structure to index
       $indexData = MyCustomPlugin::$plugin->mySearchService->getIndexData($event->sender);
       $event->indexData = $indexData;
   }
);
```

Environment based configuration
-------------------------------

[](#environment-based-configuration)

You can make the plugin's configuration environment based by adding an elastica.php file in your config directory with the following contents. This is just an example, you can name your environment variables as you want.

```
use craft\helpers\App;

return [
    'indexingEnabled' => App::env('ELASTICSEARCH_INDEXING_ENABLED') ?? true,
    'hosts' => [
        [
            App::env('CRAFT_ENVIRONMENT'),
            App::env('ELASTICSEARCH_URL'),
            App::env('ELASTICSEARCH_INDEX_PREFIX'),
        ]
    ]
];
```

Roadmap
-------

[](#roadmap)

- Logo
- Index categories
- Maybe include search proxy
- Exclude sites via settings
- Show index info / test index in utility
- More documentation

---

 [![Made with love by Fork](resources/img/heart.png)](resources/img/heart.png)Brought to you by [Fork Unstable Media GmbH](https://www.fork.de)

###  Health Score

46

—

FairBetter than 92% of packages

Maintenance55

Moderate activity, may be stable

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 65.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~134 days

Recently: every ~64 days

Total

14

Last Release

297d ago

Major Versions

1.0.2.2 → 2.0.02024-10-02

2.0.0 → 3.0.x-dev2024-11-12

3.0.0 → 4.0.02024-11-19

3.x-dev → 4.1.02025-01-30

4.x-dev → 5.0.02025-10-15

PHP version history (2 changes)2.0.0PHP ^8.0

3.0.x-devPHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/b311a0b266c1d9a68680ed041668f32515ceb93cf2f2c258861e100caa67745e?d=identicon)[objfork](/maintainers/objfork)

---

Top Contributors

[![scholejo](https://avatars.githubusercontent.com/u/9337219?v=4)](https://github.com/scholejo "scholejo (40 commits)")[![rocknrolaf](https://avatars.githubusercontent.com/u/366853?v=4)](https://github.com/rocknrolaf "rocknrolaf (16 commits)")[![barnslig](https://avatars.githubusercontent.com/u/734101?v=4)](https://github.com/barnslig "barnslig (5 commits)")

---

Tags

searchelasticsearchcmsCraftcraftcmscraft-pluginelastica

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/fork-craft-elastica/health.svg)

```
[![Health](https://phpackages.com/badges/fork-craft-elastica/health.svg)](https://phpackages.com/packages/fork-craft-elastica)
```

###  Alternatives

[verbb/formie

The most user-friendly forms plugin for Craft.

101400.6k76](/packages/verbb-formie)[studioespresso/craft-scout

Craft Scout provides a simple solution for adding full-text search to your entries. Scout will automatically keep your search indexes in sync with your entries.

80145.6k](/packages/studioespresso-craft-scout)[verbb/hyper

A user-friendly links field for Craft.

24153.5k14](/packages/verbb-hyper)[verbb/vizy

A flexible visual editor field for Craft.

4251.5k1](/packages/verbb-vizy)[verbb/events

A full-featured plugin for event management and ticketing.

2312.1k](/packages/verbb-events)[la-haute-societe/craft-elasticsearch

Bring the power of Elasticsearch to your Craft CMS projects.

1712.5k](/packages/la-haute-societe-craft-elasticsearch)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
