The CakePHP core team is proud to announce the immediate availability of CakePHP Elasticsearch 5.0.0. This is a major release for the 5.x branch that includes breaking changes and new features.
Breaking Changes
- Elastica 9.x Support: Upgraded from
ruflin/elastica7.x to 9.x, bringing support for Elasticsearch 9.x.- As Elastica now uses elasticsearch-php the client configuration using the
hostsarray format could be used instead of the legacyhost/portoruriformat (still working).
- As Elastica now uses elasticsearch-php the client configuration using the
- CakePHP 5.2+ Required: Minimum CakePHP version is now 5.2.0.
- PHP 8.1+ Required: Dropped support for older PHP versions.
- IndexRegistry Removed: The deprecated
IndexRegistryclass has been removed in favor ofIndexLocatorwithIndexLocatorAwareTrait. - Removed Deprecated Methods: All methods deprecated in 3.x and 4.x have been removed:
QueryBuilder::and_()andQueryBuilder::or_()- Useand()andor()insteadEmbedded::property(),entityClass(),indexClass()- Use getter/setter methods insteadQuery::repository()- UsesetRepository()instead
New Features
- IndexLocatorAwareTrait: New trait providing access to the
IndexLocatorwith afetchIndex()method, aligning with the ORM'sfetchTable()pattern. - InvalidPropertyInterface Support: Documents now support
InvalidPropertyInterfacefor validation error handling. - Track Total Hits: Added
Query::trackTotalHits()method for control over Elasticsearch'strack_total_hitsfeature. - FQDN Class Support:
IndexLocatornow supports fully-qualified class names for index loading.
Improvements
- Strict Typing: Improved strict types throughout the codebase.
- Code Quality: Removed PHPStan baseline, added Rector support, and improved test coverage to +- 90%.
- PHPUnit 10-12 Support: Updated test suite to support PHPUnit 10.5+, 11.5+, and 12.1+.
- Marshaller Alignment: Better alignment with CakePHP ORM patterns.
- Improved Type Hints: Enhanced type hinting across the codebase.
Full Changelog: 4.0.1...5.0.0
As always, a huge thanks to all the community members that helped make this release happen.