PHPackages                             directorytree/opensearch-migrations - 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. [API Development](/categories/api)
4. /
5. directorytree/opensearch-migrations

ActiveLibrary[API Development](/categories/api)

directorytree/opensearch-migrations
===================================

OpenSearch migrations for Laravel

v1.0.0(1mo ago)2602↑33.3%[1 PRs](https://github.com/DirectoryTree/OpenSearchMigrations/pulls)MITPHPPHP ^8.2CI passing

Since Jun 23Pushed 3w agoCompare

[ Source](https://github.com/DirectoryTree/OpenSearchMigrations)[ Packagist](https://packagist.org/packages/directorytree/opensearch-migrations)[ RSS](/packages/directorytree-opensearch-migrations/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (1)Dependencies (11)Versions (3)Used By (0)

OpenSearch Migrations
=====================

[](#opensearch-migrations)

OpenSearch index migrations for Laravel.

[![](https://camo.githubusercontent.com/53294a3a45c30d701b2e3398cf91171f76f33ee121a632b143a3e12ddde17acc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f4469726563746f7279547265652f4f70656e5365617263684d6967726174696f6e732f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/DirectoryTree/OpenSearchMigrations/actions)[![](https://camo.githubusercontent.com/efa22e66550bab919a741c8e02cf442e14fbd692efd5e57aa5af2666efb8d371/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6469726563746f7279747265652f6f70656e7365617263682d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/directorytree/opensearch-migrations)[![](https://camo.githubusercontent.com/d7aa089b30f536a50a72d4ad133d068950864aea9529081250e099fa37857b8c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6469726563746f7279747265652f6f70656e7365617263682d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/directorytree/opensearch-migrations)[![](https://camo.githubusercontent.com/d7a4afbf7dd276e7e82f5be664df2edbd76de1407b991fdf4c60967daebdf893/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6469726563746f7279747265652f6f70656e7365617263682d6d6967726174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/directorytree/opensearch-migrations)

---

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

[](#installation)

Install the package with Composer:

```
composer require directorytree/opensearch-migrations
```

Publish the OpenSearch client configuration:

```
php artisan vendor:publish --provider="DirectoryTree\OpenSearchClient\OpenSearchClientServiceProvider"
```

Publish the migration configuration:

```
php artisan vendor:publish --provider="DirectoryTree\OpenSearchMigrations\OpenSearchMigrationsServiceProvider"
```

Configuration
-------------

[](#configuration)

The migration configuration is published to `config/opensearch-migrations.php`:

```
'table' => env('OPENSEARCH_MIGRATIONS_TABLE', 'opensearch_migrations'),

'connection' => env('OPENSEARCH_MIGRATIONS_CONNECTION'),

'storage_directory' => env('OPENSEARCH_MIGRATIONS_DIRECTORY', base_path('opensearch/migrations')),

'index_name_prefix' => env('OPENSEARCH_MIGRATIONS_INDEX_NAME_PREFIX', env('SCOUT_PREFIX', '')),

'alias_name_prefix' => env('OPENSEARCH_MIGRATIONS_ALIAS_NAME_PREFIX', env('SCOUT_PREFIX', '')),
```

Creating Migrations
-------------------

[](#creating-migrations)

Create a migration:

```
php artisan opensearch:make:migration create_posts_index
```

Migration files are stored in `opensearch/migrations` by default:

```
use DirectoryTree\OpenSearchAdapter\Indices\Mapping;
use DirectoryTree\OpenSearchAdapter\Indices\Settings;
use DirectoryTree\OpenSearchMigrations\Facades\Index;
use DirectoryTree\OpenSearchMigrations\MigrationInterface;

class CreatePostsIndex implements MigrationInterface
{
    public function up(): void
    {
        Index::create('posts', function (Mapping $mapping, Settings $settings) {
            $mapping->text('title');
            $mapping->text('body');
        });
    }

    public function down(): void
    {
        Index::dropIfExists('posts');
    }
}
```

Running Migrations
------------------

[](#running-migrations)

Run all pending migrations:

```
php artisan opensearch:migrate
```

Run a single migration:

```
php artisan opensearch:migrate 2026_01_01_000000_create_posts_index
```

Roll back the last batch:

```
php artisan opensearch:migrate:rollback
```

Roll back every migrated file:

```
php artisan opensearch:migrate:reset
```

Roll back and rerun every migration:

```
php artisan opensearch:migrate:refresh
```

Drop all indexes and rerun every migration:

```
php artisan opensearch:migrate:fresh
```

Show migration status:

```
php artisan opensearch:migrate:status
```

Credits
-------

[](#credits)

This package builds on a lot of the foundation and prior work from [Ivan Babenko](https://github.com/babenkoivan) and his Elasticsearch Laravel ecosystem packages.

We're grateful for the work he has shared with the Laravel community. If this package helps your work, consider supporting Ivan through [GitHub Sponsors](https://github.com/sponsors/babenkoivan).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance93

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

45d ago

### Community

Maintainers

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

---

Top Contributors

[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (42 commits)")

---

Tags

phplaravelopensearchmigrations

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/directorytree-opensearch-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/directorytree-opensearch-migrations/health.svg)](https://phpackages.com/packages/directorytree-opensearch-migrations)
```

###  Alternatives

[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M282](/packages/laravel-ai)[illuminate/queue

The Illuminate Queue package.

20433.0M1.8k](/packages/illuminate-queue)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M142](/packages/roots-acorn)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k161.4k1](/packages/mike-bronner-laravel-model-caching)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M353](/packages/psalm-plugin-laravel)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.0k](/packages/forjedio-inertia-table)

PHPackages © 2026

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