openclassrooms/elasticsearch-bundle
Symfony bundle that integrates Elasticsearch into your app, providing configuration and services to index, search, and manage documents. It wires Elasticsearch clients into the Symfony DI container and offers tools for building and querying indexes.
elasticsearch/elasticsearch client version that matches your cluster’s major version. Confirm the server version first (curl localhost:9200) — mismatched client/server majors are the most common failure mode with bundles of this vintage.composer require openclassrooms/elasticsearch-bundle. If the repo has no tagged release, pin a specific commit hash rather than a branch.app/AppKernel.php in the bundles array (new OpenClassrooms\Bundle\ElasticsearchBundle\OpenClassroomsElasticsearchBundle()).openclassrooms_elasticsearch: block in app/config/config.yml (or config/packages/ if you’re back-porting). Typical keys are hosts, index_prefix, and logging options — verify actual key names in DependencyInjection/Configuration.php, since bundle config shapes drift between commits.Resources/config/services.xml (or .yml) for the real service IDs, and the DependencyInjection/ folder for how the client is constructed. Don’t trust README examples for service IDs — they go stale fastest.match query and dump the hit count. This confirms config, auth, and mapping in one pass before you build anything on top.Elasticsearch\Client manually — inject the bundle-provided service so connection settings and logging stay centralized. Wrap it in your own SearchService/Indexer so controllers never touch raw DSL.myapp_dev, myapp_prod) so dev/test traffic never collides with production.ProductIndexRepository per document type, encapsulating mapping, indexing, and query construction. This gives you a clean seam to swap to Elastica or the official Symfony integration later.bulk() in a loop over array_chunk(), and check per-item results (see Gotchas).products_v2), bulk-load, run a _count sanity check, then atomically swap the read alias in a single _aliases call. Never mutate a live index in place.postPersist/postUpdate via a listener. Be aware this runs inside the transaction — prefer queuing into a message/table and draining asynchronously so a failed index doesn’t roll back a legitimate DB write.app:search:reindex and app:search:health commands. They become the operational interface for ops and CI.composer.lock committed), and budget for a migration to FOSElasticaBundle or direct elasticsearch/elasticsearch usage on your next Symfony major upgrade.No handler found for uri, this is why. The bundle does not abstract API differences.index/type/id will break on ES 7+. Your wrappers should speak index/_doc/id.bulk() returns HTTP 200 even when individual items fail. Always check $response['errors'] and iterate $response['items'] for non-2xx status per item — otherwise silent data loss.refresh: true is a trap in production: it forces an immediate segment refresh and will crater indexing throughput. Only use it in tests or right before an assertion; in prod rely on the default refresh interval.elasticsearch: as the root key, newer ones openclassrooms_elasticsearch:. If config is silently ignored, run app/console config:dump-reference <bundle> to see what the installed version actually expects.actions array form of _aliases.scroll scans hold server-side context. Always call clearScroll in a finally block and size batches (~1000 docs) to your heap.Monolog handler at debug) — logging the full request body is the single most useful debugging lever.services.yml (Symfony lets app-level definitions win) rather than editing vendor. If the bundle exposes parameters for hosts/prefix, use those; otherwise a compiler pass is the cleanest injection point.How can I help you explore Laravel packages today?