Weave 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
Elasticsearch Bundle

Elasticsearch Bundle Laravel Package

ongr/elasticsearch-bundle

The Ongr Elasticsearch Bundle integrates Elasticsearch with Symfony applications, offering configuration-driven document object mapping, repositories, indexing, bulk operations, aggregations, and flexible query building for scalable full-text search and analytics in PHP projects.

View on GitHub
Deep Wiki
Context7

ONGR ElasticsearchBundle integrates Elasticsearch into Symfony applications, providing a powerful abstraction over the official elasticsearch-php client. Define documents with annotations, let the bundle build and manage your indexes, and use repositories to query them—keeping search logic clean and decoupled from your controllers.

  • Annotation-based document mapping with automatic index creation
  • Repository pattern for building and running Elasticsearch queries
  • Console commands for index management and reindexing
  • Configurable multiple connections and index per environment
  • Seamless Symfony DI integration and event listeners
Frequently asked questions about Elasticsearch Bundle
Can I use ongr/elasticsearch-bundle in a Laravel application?
You can install it with Composer, but it is a Symfony bundle and Laravel has no bundle lifecycle. Its value comes from Symfony configuration trees, compiler passes, and kernel wiring, none of which Laravel provides, so you would be importing a foreign integration layer and bypassing half of it. For a Laravel app, use the official elasticsearch/elasticsearch client directly or Laravel Scout with an Elasticsearch driver.
How do I install ongr/elasticsearch-bundle?
Install it with composer require ongr/elasticsearch-bundle. In Symfony you then register the bundle in bundles.php and configure it through a YAML or XML tree under the bundle's extension alias. That registration step has no Laravel equivalent, so installation alone will not produce a working integration in a Laravel project without a custom service provider and manual configuration loading.
Which Elasticsearch server versions does ongr/elasticsearch-bundle support?
The last release was March 2023, which points to Elasticsearch 7.x and an older elasticsearch-php client. Elasticsearch 8.x and 9.x clusters will likely require code changes at the client boundary. Check the declared elasticsearch/elasticsearch constraint in composer.json and test against your actual cluster version before committing.
Is ongr/elasticsearch-bundle actively maintained?
The last release date in 2023 and a low dependent-package count suggest a low-activity project. Look at recent issue and PR throughput plus any published security advisories before you depend on it. There is no visible commercial backing or large community safety net, so budget for owning fixes yourself.
What is the best Laravel alternative to this bundle?
Use the official elasticsearch/elasticsearch PHP client wrapped in a Laravel service provider, or Laravel Scout with an Elasticsearch engine. Both follow Laravel conventions, are actively maintained, and avoid importing Symfony's configuration and container patterns. Wrap your queries in a thin repository or query-builder abstraction so mapping concerns stay isolated.
Can I use ongr/elasticsearch-bundle with Laravel Scout?
Not directly. Scout expects an engine driver implementing Laravel's Engine contract, while this bundle provides a Symfony repository and ODM layer instead. Bridging the two would require a custom adapter that mostly duplicates work, which defeats the purpose. Use an existing Scout Elasticsearch driver and skip the bundle entirely.
Can I reuse just the ODM document mapping layer in Laravel?
The document mapping and repository layers are bundle-aware and not cleanly extractable without forking the package. You can port the mapping metadata and repository semantics by hand onto a plain client wrapper. Treat that as a re-implementation rather than a lift-and-shift, and only fork if a prototype with the official client demonstrably falls short.
Why doesn't the Symfony bundle wiring work in Laravel?
The bundle depends on Symfony's Extension for YAML and XML configuration trees, compiler passes, and kernel bundle registration. Laravel uses service providers with a different container and configuration-loading model, so the concepts are analogous but not interchangeable. Bypassing those pieces leaves you with only the client and mapping parts, which are easily replaced by a first-class library.
How should I test Elasticsearch integration in a Laravel app?
Run integration tests against a real Elasticsearch container, for example with Testcontainers or a docker-compose service, rather than mocking the client. In Laravel, bind the client in the service container and swap the binding in your test suite. If you adopt Scout, its engine faking and index assertions cover most indexing workflows.
How do I migrate a Symfony app using this bundle to Laravel?
Treat it as a re-implementation of the document mapping and repository concerns, not a lift-and-shift. Port the mapping metadata and query semantics onto a Laravel-native client wrapper or Scout. Before starting, pin and verify PHP version bounds, Symfony component versions, and the elasticsearch-php major version, since those rarely align cleanly with a current Laravel stack.
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.
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo
bernskioldmedia/laravel-harvest
bernskiold/laravel-data-scrubber
bernskiold/laravel-currency-converter
bernskiold/laravel-campaign-monitor
bernskioldmedia/laravel-autotranslate
siberfx/telegram-bot
roy-sandip/laravel-view-extended
gregsphotography/site-builder-core
roy-sandip/laravel-view
anodyne/blade-fluentui-icons
webx-ui/module-catalog-collections