Download the PHP package t3g/elasticorn without Composer

On this page you can find all versions of the php package t3g/elasticorn. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package elasticorn

Elasticorn - PHP based elasticsearch manager

Scrutinizer Code Quality build Status

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

Features

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

Installation

Composer based:

composer require t3g/elasticorn

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

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

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

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

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

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

composer based usage command:

./elasticorn.php -h

phar usage command:

./elasticorn.phar -h

Commands

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

Elasticorn comes with unit and acceptance tests.

Unit tests

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

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


All versions of elasticorn with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0
ruflin/elastica Version ^7.1
symfony/yaml Version ^5.0
symfony/console Version ^5.0
symfony/dependency-injection Version ^5.0
sebastian/diff Version ^4.0
vlucas/phpdotenv Version ^2.3
consolidation/self-update Version ^1.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package t3g/elasticorn contains the following files

Loading the files please wait ....