What's New in V3
V3 represents a near-complete rewrite of the Laravel-Opensearch package. This update delivers a more seamless integration with Laravel’s Models, Eloquent, and Query Builders while providing greater access to OpenSearch’s advanced features.
New features
Section titled “New features”Laravel generated IDs:
Section titled “Laravel generated IDs:”- Ids can be generated on the Laravel side by using the
GeneratesUuids
or theGeneratesElasticIds
trait. Docs
Query field map
Section titled “Query field map”- Field Maps can be defined in the model to map text to keyword fields, boosting performance Docs
Fluent query options as a callback
Section titled “Fluent query options as a callback”- All clauses in the query builder now accept an optional callback of OpenSearch options to be applied to the clause. Docs
BelongsToMany Relationships
Section titled “BelongsToMany Relationships”BelongsToMany
relationships are now supported. Docs
New queries
Section titled “New queries”Three powerful new query methods have been added to simplify expressive search:
New aggregations
Section titled “New aggregations”- Stats Aggregations Docs
- Extended Stats Aggregations - Docs
- Cardinality Aggregations - Docs
- Median Absolute Deviation Aggregations - Docs
- Percentiles Aggregations - Docs
Migrations: Add Normalizer
Section titled “Migrations: Add Normalizer”- Normalizers can now be defined in migrations. Docs
Direct Access to OpenSearch PHP client
Section titled “Direct Access to OpenSearch PHP client”For low-level operations, you can access the native OpenSearch PHP client directly:
Connection::on('opensearch')->openClient()->{clientMethod}();
V3 Under the Hood
Section titled “V3 Under the Hood”This release is a complete architectural overhaul designed to mirror Laravel’s Eloquent ORM more closely.
The internals have been refactored for better testability, performance, and future extensibility.