v5.7.0
This release is compatible with Laravel 11, 12 & 13
Added
whereNestedFieldExists($path)(docs) - explicit, zero-overhead check for "this nested path has at least one document." Emits the idiomaticnested + existsform directly, no closure required. Variants:whereNotNestedFieldExists,orWhereNestedFieldExists,orWhereNotNestedFieldExists.whereFieldExists($field)(docs) - properly named alias for the Elasticsearchexistsquery. Variants:whereNotFieldExists,orWhereFieldExists,orWhereNotFieldExists.nestedQuery($column)(docs) - returns a pre-configured Builder you can build up across conditionals and functions, then pass straight towhereNestedObject(). The closure form still works for simple cases; this is the escape hatch for programmatic composition.whereNestedObject()now accepts a pre-built Builder (fromnestedQuery()) in addition to a Closure or raw DSL string. Invalid input now throwsBuilderExceptioninstead of silently being stored.
Changed
- Exists queries on nested-mapped fields auto-wrap in
nested(docs) -whereFieldExists('comments.country'),whereNotNull('comments.country'), andwhereNull('comments.country')now emit the idiomaticnested { path: comments, query: { exists: ... } }form when the target field lives under a nested path. Detection only fires for dotted field names - bare-field calls (whereNotNull('title')) pay no overhead. - IDE/PHPDoc improvements -
find,first,firstOrCreatenow returnstatic(not the abstract baseModel), so subclass property hints resolve correctly. Collection-returning methods (get,rawSearch,distinct,bulkDistinct) annotated asarray<int, static>soforeachtyping works in PhpStorm.ElasticCollectiontemplate hygiene tightened (FQN parent in@extends, dropped name-collidinguse Model as TModelalias).
Deprecated
whereTermExistsfamily - replaced bywhereFieldExists. TheTermprefix was historical (the underlying ES query isn't term-related) and the old name avoided collision with Laravel's basewhereExists(Closure). Old methods still work; will be removed in v6:whereTermExists→whereFieldExistswhereNotTermExists→whereNotFieldExistsorWhereTermExists→orWhereFieldExistsorWhereNotTermsExists→orWhereNotFieldExists(also fixes the typo'd plural "Terms")
Full Changelog: v5.6.1...v5.7.0