saved, deleted) to auto-sync Elasticsearch, reducing boilerplate for CRUD operations.elasticsearch/elasticsearch) and index name prefixes, accommodating multi-tenant or shared-cluster setups.with() or eager loading) is powerful but may require explicit configuration for complex many-to-many scenarios.0.8.0 for L4) or monitoring the repo for L5-specific tags.fullText column) may require manual mapping adjustments.elasticsearch/elasticsearch) but may require adjustments for custom setups (e.g., AWS OpenSearch).Model::find(1)->save() triggers reindex).Model::search('query')->get() matches SQL results).Product) and its most critical search queries.Artisan commands or custom scripts:
php artisan larasearch:reindex App\Model
LIKE queries) post-validation.elasticsearch/elasticsearch v7.x. Override via config if using alternatives (e.g., ruflin/elastica).Iverberk\Larasearch\Traits\Searchable for:
searchableAs('custom_index')).searchableExclude(['password'])).searchableWith(['category', 'tags'])).Searchable trait to Eloquent models.searchable() method for custom mappings if needed.// Before
$results = DB::table('products')->where('name', 'like', '%query%')->get();
// After
$results = Product::search('query')->get();
forceMerge).ModelReindexFailed (e.g., Elasticsearch connection issues).SearchQueryTimeout (e.g., slow aggregations).search(), where(), orderBy()).aggregations(), highlight()).Model::search('query')->toElasticQuery()).Product::chunk(100, function ($products) {
Product::search()->reindex($products);
});
wildcard or regexp queries in production.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Elasticsearch downtime | Search queries fail | Fallback to SQL |
How can I help you explore Laravel packages today?