Skip to content

v5.7.0

Choose a tag to compare

@pdphilip pdphilip released this 24 May 02:09
· 6 commits to main since this release

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 idiomatic nested + exists form directly, no closure required. Variants: whereNotNestedFieldExists, orWhereNestedFieldExists, orWhereNotNestedFieldExists.
  • whereFieldExists($field) (docs) - properly named alias for the Elasticsearch exists query. Variants: whereNotFieldExists, orWhereFieldExists, orWhereNotFieldExists.
  • nestedQuery($column) (docs) - returns a pre-configured Builder you can build up across conditionals and functions, then pass straight to whereNestedObject(). The closure form still works for simple cases; this is the escape hatch for programmatic composition.
  • whereNestedObject() now accepts a pre-built Builder (from nestedQuery()) in addition to a Closure or raw DSL string. Invalid input now throws BuilderException instead of silently being stored.

Changed

  • Exists queries on nested-mapped fields auto-wrap in nested (docs) - whereFieldExists('comments.country'), whereNotNull('comments.country'), and whereNull('comments.country') now emit the idiomatic nested { 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, firstOrCreate now return static (not the abstract base Model), so subclass property hints resolve correctly. Collection-returning methods (get, rawSearch, distinct, bulkDistinct) annotated as array<int, static> so foreach typing works in PhpStorm. ElasticCollection template hygiene tightened (FQN parent in @extends, dropped name-colliding use Model as TModel alias).

Deprecated

  • whereTermExists family - replaced by whereFieldExists. The Term prefix was historical (the underlying ES query isn't term-related) and the old name avoided collision with Laravel's base whereExists(Closure). Old methods still work; will be removed in v6:
    • whereTermExistswhereFieldExists
    • whereNotTermExistswhereNotFieldExists
    • orWhereTermExistsorWhereFieldExists
    • orWhereNotTermsExistsorWhereNotFieldExists (also fixes the typo'd plural "Terms")

Full Changelog: v5.6.1...v5.7.0