Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Seal Elasticsearch Adapter

Seal Elasticsearch Adapter Laravel Package

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).

View on GitHub
Deep Wiki
Context7

An adapter to support elasticsearch in cmsig/seal search abstraction.

Frequently asked questions about Seal Elasticsearch Adapter
How do I integrate this Elasticsearch adapter into a Laravel application using SEAL?
Install via Composer (`composer require cmsig/seal cmsig/seal-elasticsearch-adapter`), then create an `Engine` instance by passing an `ElasticsearchAdapter` (initialized with the official Elasticsearch PHP client) and your schema. Register it in Laravel’s service container for dependency injection. Example: `app()->bind(Engine::class, fn() => new Engine(new ElasticsearchAdapter($client), $schema));`.
Does this adapter support Laravel Scout for search functionality?
While not natively integrated with Scout, you can wrap the `ElasticsearchAdapter` in a custom `ScoutEngine` to replace Scout’s Elasticsearch driver. Override methods like `search`, `mapIdsToModels`, and `mapModelsToIds` to align with Scout’s contract. This allows seamless use with Laravel’s Scout features like indexing and querying models.
What Laravel versions are compatible with this package?
The package does not explicitly state Laravel version support in its documentation, but it follows Laravel’s dependency injection and service container patterns. Test with Laravel 8.x or 9.x for compatibility, as these versions align with the package’s modern PHP (8.0+) requirements. Check the `cmsig/search` repo for updates.
How does the $schema parameter work with Laravel Eloquent models?
The `$schema` parameter defines the structure of documents sent to Elasticsearch, similar to Eloquent’s schema definitions. For Laravel models, you can use a `Searchable` trait or custom schema builder to map model attributes to Elasticsearch fields. Complex relationships (e.g., polymorphic) may require manual mapping or nested schema definitions.
Can I configure Elasticsearch via Laravel’s .env file using DSN?
Yes, the adapter supports DSN-style configuration in `.env`, such as `elasticsearch://user:pass@host:port?tls=true`. This integrates natively with Laravel’s configuration system. Parse the DSN in your `config/elasticsearch.php` to extract host, credentials, and TLS settings for the Elasticsearch client.
Are bulk operations (e.g., indexMany) optimized for Laravel queues?
The adapter itself doesn’t enforce queue usage, but you can offload bulk operations to Laravel queues (e.g., `SearchIndexJob`) to avoid blocking HTTP requests. Use `dispatchSync` or `dispatch` to queue indexing/deletion tasks, leveraging Elasticsearch’s refresh intervals for performance.
How does this adapter handle security, like TLS and credential validation?
The adapter supports TLS via DSN (e.g., `?tls=true`) and relies on the official Elasticsearch PHP client for credential handling. However, it doesn’t explicitly validate credentials or sanitize DSN strings. For production, ensure credentials are stored securely (e.g., Laravel’s `env` or vault) and enforce TLS in your DSN.
What are the alternatives to this package for Laravel Elasticsearch integration?
Alternatives include Laravel Scout’s built-in Elasticsearch driver, the official `elasticsearch/elasticsearch` PHP client, or packages like `spatie/laravel-searchable`. Scout is the most Laravel-native option, while the official client offers full Elasticsearch API access. This adapter provides abstraction via SEAL for decoupled search logic.
How do I migrate from the official Elasticsearch PHP client to this adapter?
Start by replacing direct client calls in a non-critical module (e.g., a blog search feature) with the `ElasticsearchAdapter`. Use feature flags to toggle between implementations during testing. Gradually refactor remaining code to use the SEAL `Engine` interface, ensuring schema compatibility and testing edge cases.
Does this package support monitoring or error handling for Elasticsearch queries?
The adapter surfaces Elasticsearch errors via the underlying client, but lacks built-in Laravel integration (e.g., logging or Sentry). Extend the `Engine` to dispatch Laravel events (e.g., `searching:failed`) or wrap the adapter in a custom layer to log errors using Laravel’s logging or monitoring tools like Horizon.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony