rapidez/laravel-scout-elasticsearch
Laravel Scout driver connecting Rapidez to Elasticsearch for fast, scalable product search. It indexes Scout models, supports flexible filtering and relevance tuning, and delivers responsive catalog search for Laravel-based ecommerce storefronts. Designed for smooth integration with the Rapidez stac...
Install the package with Composer and configure Laravel Scout to use the Elasticsearch driver:
composer require rapidez/laravel-scout-elasticsearch
Publish the package config (if applicable) and set your Scout driver in config/scout.php or via .env:
SCOUT_DRIVER=elasticsearch
ELASTICSEARCH_HOSTS=localhost:9200
Add the Laravel\Scout\Searchable trait to a model, then import existing records and run your first search:
php artisan scout:import "App\Models\Post"
Post::search('laravel')->get();
Start by reading the package README and the ElasticsearchEngine class to understand supported query methods and configuration options. The first use case is usually adding full-text search to a resource without managing Elasticsearch queries directly.
search(), where(), orderBy(), paginate()) as you would with other drivers; the package translates calls into Elasticsearch queries.toSearchableArray() on your models. Keep the array flat and include only searchable/filterable fields.php artisan scout:import with chunking (--chunk=500) to avoid memory issues. For incremental updates, Scout’s model events handle searchable()/unsearchable() automatically.SCOUT_QUEUE=true in .env. This offloads index writes to workers and keeps HTTP responses fast.where() (e.g., ->where('status', ['published', 'draft'])). As of 1.1.1, array arguments are safely handled without key-access errors.->query()) or extend the engine. Many teams wrap custom query building in a repository or scope.where clauses with array values could throw errors when accessing keys. If you previously passed arrays to where(), upgrade to avoid unexpected exceptions.composer.json for version constraints and test against your cluster before deploying.searchableAs() to avoid collisions.searchable() or use model observers to call unsearchable() when soft deleting.->toSearchableArray() on a model and compare with the indexed document, or use Kibana/Dev Tools to run the query directly.elasticsearch driver must be set in config/scout.php; environment variables like ELASTICSEARCH_HOSTS are read by the package. Clear config cache after changes (php artisan config:clear).scout:flush + scout:import) is required after mapping changes; plan for downtime or use aliases for zero-downtime reindexing.How can I help you explore Laravel packages today?