Download the PHP package ashkan-jafarzadeh/elastic-migrations without Composer

On this page you can find all versions of the php package ashkan-jafarzadeh/elastic-migrations. 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 elastic-migrations

Elastic Migrations

Latest Stable Version Total Downloads License Tests Code style Static analysis Donate PayPal

Support the project!


Elastic Migrations for Laravel allow you to easily modify and share indices schema across the application's environments.

Contents

Compatibility

The current version of Elastic Migrations has been tested with the following configuration:

Installation

The library can be installed via Composer:

If you want to use Elastic Migrations with Lumen framework check this guide.

Configuration

Elastic Migrations uses babenkoivan/elastic-client as a dependency. If you want to change the default client settings (and I'm pretty sure you do), then you need to create the configuration file first:

You can change Elasticsearch host and other client settings in the config/elastic.client.php file. Please refer to babenkoivan/elastic-client for more details.

You can also publish Elastic Migrations settings:

This will create the config/elastic.migrations.php file, which allows you to configure the following options:

Finally, don't forget to run Laravel database migrations to create Elastic Migrations table:

Writing Migrations

You can effortlessly create a new migration file using an Artisan console command:

This command creates a migration class in the elastic/migrations directory.

Every migration includes two methods: up and down. up is used to alternate the index schema and down is used to revert that action.

You can use ElasticMigrations\Facades\Index facade to perform basic operations over Elasticsearch indices:

Create Index

You can create an index with the default settings:

You can use a modifier to configure mapping and settings:

There is also the createRaw method in your disposal:

Finally, it is possible to create an index only if it doesn't exist:

Update Mapping

You can use a modifier to adjust the mapping:

Alternatively, you can use the putMappingRaw method as follows:

Update Settings

You can use a modifier to change an index configuration:

The same result can be achieved with the putSettingsRaw method:

It is possible to update analysis settings only on closed indices. The pushSettings method closes the index, updates the configuration and opens the index again:

The same can be done with the pushSettingsRaw method:

Drop Index

You can unconditionally delete the index:

or delete it only if it exists:

Create Alias

You can create an alias with optional filter query:

Delete Alias

You can delete an alias by its name:

More

Finally, you are free to inject Elasticsearch\Client in the migration constructor and execute any supported by client actions.

Running Migrations

You can either run all migrations:

or run a specific one:

Use the --force option if you want to execute migrations on production environment:

Reverting Migrations

You can either revert the last executed migrations:

or rollback a specific one:

Use the elastic:migrate:reset command if you want to revert all previously migrated files:

Starting Over

Sometimes you just want to start over, rollback all the changes and apply them again:

Alternatively you can also drop all existing indices and rerun the migrations:

Migration Status

You can always check which files have been already migrated and what can be reverted by the elastic:migrate:rollback command (the last batch):

Zero Downtime Migration

Changing an index mapping with zero downtime is not a trivial process and might vary from one project to another. Elastic Migrations library doesn't include such feature out of the box, but you can implement it in your project by following this guide.

Troubleshooting

If you see one of the messages below, follow the instructions:

In case one of the commands doesn't work as expected, try to publish configuration:


All versions of elastic-migrations with dependencies

PHP Build Version
Package Version
Requires php Version ^7.3 || ^8.0
babenkoivan/elastic-client Version ^1.2
babenkoivan/elastic-adapter Version ^2.0
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 ashkan-jafarzadeh/elastic-migrations contains the following files

Loading the files please wait ....