directorytree/opensearch-scout-driver
An OpenSearch driver for Laravel Scout that indexes, deletes, flushes, and searches your models through the configured OpenSearch client. Includes publishable client and Scout configs, optional document refreshing, and cursor pagination for deep, stable sorts.
Architecture fit
Searchable models, observers, ::search(), where() constraints, and pagination remain in application code. Adoption is a driver swap, not a rewrite — the most important fact for scoping, pilot design, and rollback.directorytree/opensearch-client, which the README exposes through a separate OpenSearchClientServiceProvider publish. The client layer owns credentials, transport, retries, and timeouts. Both layers require separate vetting; the driver is thin glue, the client is the operational surface.refresh_documents flag, and cursor pagination — not mappings, analyzers, or cutover procedure.Integration feasibility
composer require, publish Scout config, publish the client and driver configs, set SCOUT_DRIVER=opensearch, point at a host. A competent Laravel developer can get a working local index in under a day.search_after is a useful capability but creates a query-code contract: at least one explicit sort is required, and a unique indexed tie-breaker (e.g., model key) should be the final sort. Violating that can silently skip or duplicate documents during deep pagination.Technical risk
composer.json and CI coverage must be checked before commitment.where() operators, soft deletes, shouldBeSearchable(), queue-driven indexing, scout:import/scout:flush, partial bulk-failure reporting, model updates/deletes — need explicit validation against the Engine implementation.Key questions
directorytree/opensearch-client support AWS SigV4/IAM request signing for Amazon OpenSearch Service? If not, what signing middleware or authenticated proxy is required?composer.json constraints and CI actually cover?shouldBeSearchable(), scout:import, and scout:flush fully supported and tested?cursorPaginate is used without a stable explicit sort/tie-breaker — error, warning, or silent data loss?refresh_documents interact with write throughput and search freshness? What is the default and recommended production setting?Stack fit
Migration path
LIKE search or another Scout driver: provision the cluster, define mappings, run scout:import for backfill, validate result parity, then cut over behind a flag.cursorPaginate.Compatibility
composer.json constraints against our Laravel, Scout, PHP, and OpenSearch versions before the spike.Sequencing
Engine and client source; stand up a local OpenSearch container; validate install, indexing, search, where() constraints, pagination, soft deletes, shouldBeSearchable(), queue indexing, scout:import/scout:flush, and bulk-failure behavior.Maintenance
Support
Scaling
refresh_documents=false is the sensible production default for write throughput; near-real-time freshness must be designed around OpenSearch’s refresh interval, not forced per document.cursorPaginate/search_after with a stable sort and unique tie-breaker; offset-based deep pagination will not scale.Failure modes
directorytree/opensearch-client; confirm retry and timeout settings and ensure retries do not duplicate indexing operations.Ramp-up
How can I help you explore Laravel packages today?