open-dxp/elasticsearch-client-bundle
A PHP bundle that integrates the Elasticsearch client into your application, offering ready-made configuration, service registration, and convenient access for indexing, searching, and querying documents with minimal boilerplate. It simplifies connecting to Elasticsearch clusters and adding search c...
composer require open-dxp/elasticsearch-client-bundle. Despite the "client" name, this is an OpenDXP/Symfony bundle — it registers services through a *Bundle class and a DependencyInjection extension, not a Laravel service provider. Read composer.json, the bundle class, and DependencyInjection/Configuration.php before writing any code; the config tree is the authoritative list of connection options (hosts, credentials, timeouts, retries).Elasticsearch\Client yourself in application code.match query against it. That single round trip validates connection config, auth, and mapping assumptions before you build anything larger.$this->app->singleton(Client::class, fn () => ClientBuilder::create()
->setHosts(config('elasticsearch.hosts'))
->build());
SearchService / repository interface. Controllers and jobs call your interface, not Elasticsearch\Client directly. This is what makes client upgrades or a swap to Scout/another driver a contained change.created/updated/deleted into a queued SyncToElasticsearch job. Synchronous indexing on the request path is the fastest way to make writes fragile and latency-sensitive.errors flag and per-item statuses.posts_v3) and point a posts alias at it. Mapping changes become reindex-then-flip instead of downtime. Wrap this in a repeatable command (search:reindex) so every environment can run it.app/Search/Queries/*) driven by a DTO built from request input. Unit-testable, and keeps raw arrays out of controllers.->ping() plus cluster status gives you alerting for free and catches connectivity/config regressions early.^1.0. A patch release can still rename identifiers during a branding pass; review changelogs on minor bumps.elasticsearch-php major must match your cluster major. Check which client major the bundle pulls in — an accidental cross-major composer update is a silent runtime break.refresh=wait_for or accept the flake; never set refresh=true on production writes."dynamic": "strict" on critical indices so bad documents fail at index time rather than silently at query time.How can I help you explore Laravel packages today?