cmsig/seal-elasticsearch-adapter
Elasticsearch adapter for the CMSIG/SEAL search engine. Indexes and updates documents in an Elasticsearch cluster via the official PHP client. Install with composer and configure directly or via DSN (tls, auth).
Engine interface. This reduces vendor lock-in and simplifies future migrations (e.g., switching to OpenSearch).$schema parameter, suggesting compatibility with Laravel’s Eloquent-like schema definitions (e.g., Searchable traits or custom schema builders). This could integrate seamlessly with Laravel Scout or custom searchable models.ServiceProvider to register the Engine as a singleton or bind it to the container.Engine interface or act as a drop-in replacement for Elasticsearch-backed search.searching, searching:failed) if the Engine emits events.elasticsearch://user:pass@host:port?tls=true), which aligns with Laravel’s .env conventions.$schema parameter map to Laravel models? Is there a predefined structure (e.g., Searchable trait) or a custom DSL?indexMany) optimized for Laravel’s queue systems (e.g., dispatchSync)?elasticsearch/elasticsearch) to this adapter without downtime?Engine as a singleton or context-bound instance (e.g., app()->bind(SearchEngine::class, fn() => new Engine(new ElasticsearchAdapter($client), $schema))).config/elasticsearch.php to centralize host, credentials, and TLS settings.Engine to dispatch Laravel events (e.g., SearchQueryExecuted) for observability.ScoutEngine that wraps the ElasticsearchAdapter to replace Laravel Scout’s Elasticsearch driver.search, mapIdsToModels, and mapModelsToIds to align with Scout’s contract.SearchIndexJob) to avoid blocking HTTP requests.ElasticsearchAdapter.Searchable trait or DTOs) and validate it against the adapter’s requirements.elasticsearch/elasticsearch PHP client (v7+). Ensure version alignment with Laravel’s supported PHP versions (e.g., PHP 8.1+).searchable trait, ensure the adapter can sync model changes to Elasticsearch (e.g., via model observers or events).composer require cmsig/seal cmsig/seal-elasticsearch-adapter..env (e.g., ELASTICSEARCH_DSN=elasticsearch://user:pass@host:port).// config/elasticsearch.php
'connections' => [
'default' => [
'dsn' => env('ELASTICSEARCH_DSN'),
'schema' => require __DIR__ . '/schemas/search_schema.php',
],
];
// app/Providers/ElasticsearchServiceProvider.php
public function register()
{
$this->app->singleton(SearchEngine::class, fn() => new Engine(
new ElasticsearchAdapter(ClientBuilder::fromDsn(env('ELASTICSEARCH_DSN'))->build()),
config('elasticsearch.connections.default.schema')
));
}
// In a controller or service
$results = app(SearchEngine::class)->search('query', ['index' => 'products']);
cmsig/seal and elasticsearch/elasticsearch for breaking changes. Pin versions in composer.json to avoid surprises.php-cmsig/search repo to influence roadmap decisions.$schema as infrastructure-as-code. Use Laravel migrations or a package like spatie/laravel-schema-builder to manage it.log channel or a dedicated Elasticsearch audit index.telescope to inspect search queries and performance.php-cmsig/search community (GitHub discussions) for support, as this is a subtree-split project.queue:work with multiple processes to parallelize indexing.elasticsearch/elasticsearch client).artisan elasticsearch:health).| Failure Scenario | Mitigation Strategy |
|---|---|
| Elasticsearch downtime | Implement a circuit breaker (e.g., spatie/laravel-circuitbreaker) with fallback to a local cache. |
| Schema validation errors | Use Laravel’s validation pipeline to reject malformed queries before hitting Elasticsearch. |
| Connection pool exhaustion | Configure Elasticsearch client’s connection pool settings (e.g., setConnectionPool()). |
| Indexing delays | Use Laravel queues to decouple indexing from user requests. |
| Permission denied (Elasticsearch) | Store credentials in Laravel’s vault (e.g., laravel/vault) and rotate them periodically. |
How can I help you explore Laravel packages today?