directorytree / opensearch-scout-driver
OpenSearch driver for Laravel Scout
Package info
github.com/DirectoryTree/OpenSearchScoutDriver
pkg:composer/directorytree/opensearch-scout-driver
Requires
- php: ^8.2
- directorytree/opensearch-adapter: ^1.0
- directorytree/opensearch-client: ^1.0
- laravel/scout: ^10.0|^11.0|^12.0|^13.0
Requires (Dev)
- laravel/framework: ^11.0|^12.0|^13.0
- laravel/pint: ^1.0
- orchestra/testbench: ^9.0|^10.0|^11.0
- pestphp/pest: ^3.0
This package is auto-updated.
Last update: 2026-06-23 16:04:27 UTC
README
An OpenSearch driver for Laravel Scout.
Installation
Install the package with Composer:
composer require directorytree/opensearch-scout-driver
Publish the Scout configuration file if your application has not already done so:
php artisan vendor:publish --provider="Laravel\Scout\ScoutServiceProvider"
Set Scout to use OpenSearch:
'driver' => env('SCOUT_DRIVER', 'opensearch'),
Publish the OpenSearch client configuration:
php artisan vendor:publish --provider="DirectoryTree\OpenSearchClient\OpenSearchClientServiceProvider"
Publish the OpenSearch Scout configuration:
php artisan vendor:publish --provider="DirectoryTree\OpenSearchScoutDriver\OpenSearchScoutServiceProvider"
Configuration
Configure the OpenSearch client connection in config/opensearch-client.php:
'default' => env('OPENSEARCH_CONNECTION', 'default'), 'connections' => [ 'default' => [ 'hosts' => [ env('OPENSEARCH_HOST', 'localhost:9200'), ], ], ],
The Scout driver configuration is published to config/opensearch-scout.php:
'refresh_documents' => env('OPENSEARCH_SCOUT_REFRESH_DOCUMENTS', false),
Usage
Use Scout as usual:
use App\Models\Post; $posts = Post::search('laravel')->get();
The driver converts Scout builders into OpenSearch search requests and uses the configured OpenSearch client connection to index, delete, flush, and search models.