PHPackages                             t3g/elasticorn - 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. t3g/elasticorn

ActiveLibrary[Search &amp; Filtering](/categories/search)

t3g/elasticorn
==============

elastic manager based on elastica

7.0.2(4y ago)155.8k6[1 issues](https://github.com/TYPO3GmbH/elasticorn/issues)[1 PRs](https://github.com/TYPO3GmbH/elasticorn/pulls)GPL-3.0PHPPHP ^7.4 || ^8.0

Since Aug 16Pushed 1y ago13 watchersCompare

[ Source](https://github.com/TYPO3GmbH/elasticorn)[ Packagist](https://packagist.org/packages/t3g/elasticorn)[ Docs](https://elasticorn.net)[ RSS](/packages/t3g-elasticorn/feed)WikiDiscussions develop Synced 2mo ago

READMEChangelog (4)Dependencies (12)Versions (15)Used By (0)

Elasticorn - PHP based elasticsearch manager
============================================

[](#elasticorn---php-based-elasticsearch-manager)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0b6e763b34afa61181690843a02a0436c451190778ca3210a0be57444124d9ad/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5459504f33476d62482f656c61737469636f726e2f6261646765732f7175616c6974792d73636f72652e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/TYPO3GmbH/elasticorn/?branch=develop)[![build Status](https://camo.githubusercontent.com/4306b05e9263e3c92633ba32877c799759439f8569862fc7b6be5f5ab199f314/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f5459504f33476d62482f656c61737469636f726e2f6261646765732f6275696c642e706e673f623d646576656c6f70)](https://scrutinizer-ci.com/g/TYPO3GmbH/elasticorn/build-status/develop)

Elasticorn is an elasticsearch manager based on elastica. It's main feature is zero-down-time remapping of data. Compatibility
------------------------------------------------------------------------------------------------------------------------------

[](#elasticorn-is-an-elasticsearch-manager-based-on-elastica-its-main-feature-is-zero-down-time-remapping-of-datacompatibility)

- Releases 1.x are compatible with elasticsearch 2.x.
- Releases 5.x are compatible with elasticsearch 5.x.
- Releases 7.x are compatible with elasticsearch 7.x

Features
--------

[](#features)

- Zero-down time remapping of an index (including data-transfer)
- Initialize indices based on config files
- Show and compare mapping configurations

Zero downtime remapping - How it works:
---------------------------------------

[](#zero-downtime-remapping---how-it-works)

Elasticorn uses aliases to allow zero downtime remapping of an index. For each configured index elasticorn creates an index\_a and index\_b and uses an alias to point to the current active index. When applying a new mapping the currently inactive index is deleted and recreated with the new mapping. The data is then copied from the old to the new index. After the data transfer successfully completes the alias is pointed to the new index.

### Step by Step

[](#step-by-step)

- Your applications index is **not** called like in your config.
- Your applications index is indeed **two** separate indices and your configured index name is only an **alias** to the current live-index. We refer to the other index as the "standby-index".
- When changing the mapping of an index, all data of that index has to be deleted because your mapping might influence the way how your data had been analyzed before.
- Elasticorn will determine if your mapping has changed in between runs
- Elasticorn will determine which index is your current live-index and switch to your standby index
- Elasticorn will then apply your new mappings onto the standby index
- Elasticorn will copy all data from your live-index to the (freshly mapped) standby-index. This will analyze your data again as you would expect.
- Once finished, Elasticorn will change the alias from the "old" live-index to the "old" standby-index. This way the standby-index becomes the new live-index
- Elasticorn will delete all data from your "old" live-index to free up resources.
- Since switching the alias is an atomic action, your users will not experience any downtime whatsoever.
- Enjoy providing an awesome service to your users.

Installation
------------

[](#installation)

Composer based:

```
composer require t3g/elasticorn

```

Elasticsearch Client Configuration
----------------------------------

[](#elasticsearch-client-configuration)

Elasticorn assumes default connection parameters for establishing a connection to elasticsearch. If you are using a non-default setup you can configure those connection settings in a .env file. For details see below.

Index and Mapping Configuration
-------------------------------

[](#index-and-mapping-configuration)

For elasticorn to work, your configuration needs to be structured in the following way and be defined as yaml.

```
- MAIN configuration directory
  - Elasticorn.yaml*
  - IndexName directory
    - IndexConfiguration.yaml (Containing index settings)
    - Mapping.yaml (Containing mapping configuration)

```

\* optional

### Example

[](#example)

```
project
│   README.md
└───Elasticorn
	└── t3_forger_issue
    		├── Mapping.yaml
    		└── IndexConfiguration.yaml
	└── t3_forger_review
    		├── Mapping.yaml
    		└── IndexConfiguration.yaml
    └── t3_forger_user
        ├── Mapping.yaml
        └── IndexConfiguration.yaml

```

In our case the `Elasticorn` holds all information about our indices. Multiple indices can be managed by creating new folders.

The `IndexConfiguration.yaml` file specifies configuration parameters for the index (for example shards or replicas.)

The file called `Mapping.yaml` holds our type mapping.

The syntax is pretty straightforward yaml syntax which will then be parsed as an array.

We'll take a look at `Mapping.yaml` here:

```
id:
  type: integer
username:
  type: string
  index: not_analyzed
  store: true
fullname:
  type: string
  index: not_analyzed
  store: true
email:
  type: integer
  index: not_analyzed
  store: true
avatar:
  type: string

```

For an example on how the configuration should look like, see the Tests/Fixtures/Configuration folder in this project. For a list of available configuration options see the elastica documentation.

You can use a `.env` file, a command line parameter or the interactive console to specify your configuration directory.

### .env configuration

[](#env-configuration)

You can specify your configuration directory as well as specific connection params in a .env/.env.dist file which should be placed in the folder where elasticorn gets executed. The following variables may be configured:

```
configurationPath=
ELASTICA_HOST=
ELASTICA_PORT=
ELASTICA_PATH=
ELASTICA_URL=
ELASTICA_TRANSPORT=
ELASTICA_PERSISTENT=
ELASTICA_TIMEOUT=
ELASTICA_USERNAME=
ELASTICA_PASSWORD=

```

Configuring Languages
---------------------

[](#configuring-languages)

Elasticorn is able to automatically generate indices per language if your setup matches the following basic conditions:

- one index per language
- default language analyzers are configured per field in your configuration
- documents only have one language each

If those conditions match add a config file called "Elasticorn.yaml" in your index directory, for example with this configuration:

```
languages:
  - english
  - german
  - french

```

The language name has to be the name of an analyzer available in elasticsearch. On index initialization the following indices and aliases will be created:

```
Indices:
  - indexname_english_a
  - indexname_english_b
  - indexname_german_a
  - indexname_german_b
  - indexname_french_a
  - indexname_french_b

Aliases:
  - indexname_english
  - indexname_german
  - indexname_french
  - indexname (pointing to first configured language)

```

You can add additional languages after initialization by calling index:remap.

Usage
-----

[](#usage)

composer based usage command:

```
./elasticorn.php -h

```

phar usage command:

```
./elasticorn.phar -h

```

Commands
--------

[](#commands)

- `index:init` - Initializes all configured indices
- `index:remap` - applies a new mapping configuration to an existing index
- `index:cornify` - Converts a conventional index to an elasticorn index
- `mapping:compare` - allows comparison of currently applied and configured mapping
- `mapping:show` - shows currently applied mapping

Contributions and issues
========================

[](#contributions-and-issues)

All contributions are welcome. If you find any bugs, have problems or simply want to request a new feature feel free to add it to the issue tracker.

If you want to contribute code-wise, fork the repository and create a pull request.

Running the tests
-----------------

[](#running-the-tests)

Elasticorn comes with unit and acceptance tests.

#### Unit tests

[](#unit-tests)

You can run the unit test suite with `bin/phpunit -c build/phpunit.xml`.

#### Acceptance tests

[](#acceptance-tests)

> Note: The acceptance tests need a clean elasticsearch instance on localhost:9200 - do not execute these tests if you have other indices configured that you still need. The tests delete *all* indices at various points. You can configure host and port used in tests by setting `ELASTICA_HOST` and `ELASTICA_PORT` environmental variables. To get a fresh elasticsearch instance up quickly use docker: `docker run --rm -p 9200:9200 elasticsearch:5.6-alpine`

You can run the acceptance test suite with `bin/behat -c build/behat.yml`.

Building the phar
=================

[](#building-the-phar)

- Use
- Run `box compile`

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 53.2% 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 ~180 days

Recently: every ~173 days

Total

12

Last Release

1581d ago

Major Versions

1.1.2 → 5.0.02017-08-23

5.3.1 → 7.0.02021-04-17

PHP version history (2 changes)5.3.0PHP ^7.2 || ^7.3 || ^7.4

7.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/63373213aae432ce35282f7b1f0843556ca1127c9e2ea39dbeffd990c41c4427?d=identicon)[typo3com](/maintainers/typo3com)

---

Top Contributors

[![susannemoog](https://avatars.githubusercontent.com/u/321804?v=4)](https://github.com/susannemoog "susannemoog (25 commits)")[![NeoBlack](https://avatars.githubusercontent.com/u/1128085?v=4)](https://github.com/NeoBlack "NeoBlack (13 commits)")[![tmotyl](https://avatars.githubusercontent.com/u/515397?v=4)](https://github.com/tmotyl "tmotyl (3 commits)")[![janhelke](https://avatars.githubusercontent.com/u/5299739?v=4)](https://github.com/janhelke "janhelke (2 commits)")[![TYPO3IncTeam](https://avatars.githubusercontent.com/u/20440329?v=4)](https://github.com/TYPO3IncTeam "TYPO3IncTeam (1 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![maddy2101](https://avatars.githubusercontent.com/u/1925287?v=4)](https://github.com/maddy2101 "maddy2101 (1 commits)")[![andreaskienast](https://avatars.githubusercontent.com/u/1787983?v=4)](https://github.com/andreaskienast "andreaskienast (1 commits)")

---

Tags

app

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/t3g-elasticorn/health.svg)

```
[![Health](https://phpackages.com/badges/t3g-elasticorn/health.svg)](https://phpackages.com/packages/t3g-elasticorn)
```

###  Alternatives

[behat/behat

Scenario-oriented BDD framework for PHP

4.0k96.8M2.0k](/packages/behat-behat)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[cmsig/seal-symfony-bundle

An integration of CMS-IG SEAL search abstraction into Symfony Framework.

15195.8k5](/packages/cmsig-seal-symfony-bundle)

PHPackages © 2026

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