Elastic Scout Driver Plus
Advanced Elasticsearch query builder extending Elastic Scout Driver.
Repository Health
Technical Analysis
Elastic Scout Driver Plus is an extension of Elastic Scout Driver that unlocks the full expressiveness of Elasticsearch queries in Laravel. Where the base driver covers standard Scout search, this package adds a fluent query builder for compound queries, aggregations, highlighting, suggestions, and raw query DSL.
It provides dedicated builder classes for bool, match, term, range, geo, fuzzy, and many other Elasticsearch query types, letting developers compose complex searches in readable PHP. Results come back as rich, mappable collections with access to hits, scores, highlights, and aggregations, so applications can build faceted search, relevance tuning, and geo queries while still hydrating Eloquent models.
What You Get
- A fluent builder for compound Elasticsearch queries (bool, match, term, range, geo, and more)
- Support for aggregations, highlighting, and suggesters
- Raw query DSL escape hatch for arbitrary Elasticsearch requests
- Rich result objects exposing hits, scores, highlights, and aggregations
- Eloquent model hydration and pagination
Common Use Cases
- Building faceted or filtered search with Elasticsearch aggregations
- Composing multi-clause bool queries with relevance tuning
- Running geo-distance and geo-shape searches from Laravel
Under The Hood
Architecture - The package extends the base driver with its own Engine (and a NullEngine) plus a large Builders hierarchy: an AbstractParameterizedQueryBuilder is subclassed by one builder per Elasticsearch query type (BoolQueryBuilder, FuzzyQueryBuilder, GeoDistanceQueryBuilder, ExistsQueryBuilder, and many more). A QueryParameters subsystem (collections, transformers, validators, shared traits) assembles and validates the request body, while Decorators, a custom Paginator, and a Searchable trait shape results. Queueable Jobs handle bulk indexing.
Tech Stack - Pure PHP (php ^8.3) with strict types, built on babenkoivan/elastic-scout-driver ^6.0 (and through it elastic-adapter and Laravel Scout). PSR-4 autoloaded, distributed via Packagist, with GitHub Actions CI.
Code Quality - The builder-per-query-type design keeps each class small and single-purpose, and the separate parameter transformer/validator layer centralizes correctness checks for the generated DSL. Dedicated exceptions give clear failure messages. It is the most feature-rich package in the family (62 releases), with a maintained test suite; recent commit cadence is low but the surface is mature.
API Design - The fluent builder reads close to the Elasticsearch query DSL itself, so developers familiar with Elasticsearch map their mental model directly onto method chains, while a raw-DSL escape hatch covers anything the builders miss. The trade-off is a larger API surface than the base driver, which raises the learning curve, but result objects expose hits, highlights, and aggregations in a consistent, discoverable way.