You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+37-11Lines changed: 37 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,32 @@
2
2
3
3
All notable changes to this `laravel-elasticsearch` package will be documented in this file.
4
4
5
+
## v5.7.0 - 2026-05-24
6
+
7
+
This release is compatible with Laravel 11, 12 & 13
8
+
9
+
### Added
10
+
11
+
-**`whereNestedFieldExists($path)`** ([docs](https://elasticsearch.pdphilip.com/eloquent/nested-queries#where-nested-field-exists)) - explicit, zero-overhead check for "this nested path has at least one document." Emits the idiomatic `nested + exists` form directly, no closure required. Variants: `whereNestedFieldDoesntExist`, `orWhereNestedFieldExists`, `orWhereNestedFieldDoesntExist`.
12
+
-**`whereFieldExists($field)`** ([docs](https://elasticsearch.pdphilip.com/eloquent/eloquent-queries#wherefieldexists)) - properly named alias for the Elasticsearch `exists` query. Variants: `whereFieldDoesntExist`, `orWhereFieldExists`, `orWhereFieldDoesntExist`.
13
+
-**`nestedQuery($column)`** ([docs](https://elasticsearch.pdphilip.com/eloquent/nested-queries#building-the-inner-query-programmatically)) - 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.
14
+
-`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.
15
+
16
+
### Changed
17
+
18
+
-**Exists queries on nested-mapped fields auto-wrap in `nested`** ([docs](https://elasticsearch.pdphilip.com/eloquent/eloquent-queries#wherenotnull)) - `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.
19
+
-**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).
20
+
21
+
### Deprecated
22
+
23
+
-**`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:
24
+
-`whereTermExists` → `whereFieldExists`
25
+
-`whereNotTermExists` → `whereFieldDoesntExist`
26
+
-`orWhereTermExists` → `orWhereFieldExists`
27
+
-`orWhereNotTermsExists` → `orWhereFieldDoesntExist` (also fixes the typo'd plural "Terms")
> **Future-proofing note:** After GitHub incorrectly shadow-banned my account (since reinstated with no
@@ -13,7 +39,7 @@ This release is compatible with Laravel 11, 12 & 13
13
39
14
40
### Fixed
15
41
16
-
-**Laravel 13.3 compatibility**—`newCollection()` override on base Model to prevent `HasCollection`
42
+
-**Laravel 13.3 compatibility**-`newCollection()` override on base Model to prevent `HasCollection`
17
43
trait from attempting to instantiate the abstract parent class (`Cannot instantiate abstract class`
18
44
error introduced in Laravel 13.3's new `resolveCollectionFromAttribute` grandchild resolution)
19
45
-**QueryException** crash on `Undefined array key "error"` when Elasticsearch returns responses
@@ -41,7 +67,7 @@ This release is compatible with Laravel 11, 12 & 13
41
67
### Refactored
42
68
43
69
- Collapsed Laravel version compatibility layer from 12 files (4 dispatchers + 4 v11 traits + 4 v12 traits) into 4 self-contained traits. Version checks now happen inside each method with spread operators for different constructor
44
-
signatures — no more file-level conditional trait loading. Removed phpstan bootstrap `class_alias` hacks that were needed for the old pattern.
70
+
signatures - no more file-level conditional trait loading. Removed phpstan bootstrap `class_alias` hacks that were needed for the old pattern.
@@ -50,7 +76,7 @@ This release is compatible with Laravel 11, 12 & 13
50
76
### Fixed
51
77
52
78
-`distinct()`, `bulkDistinct()`, and `groupBy()` now work on nested fields (e.g., `distinct('tags.key', true)`). Previously these returned empty results because the compiled DSL lacked the required `nested` aggregation wrapper. The package
53
-
now auto-detects nested mappings and wraps aggregations accordingly — no changes needed in userland code.
79
+
now auto-detects nested mappings and wraps aggregations accordingly - no changes needed in userland code.
54
80
- When `whereNestedObject()` is combined with `distinct()` on the same nested path, the nested filter is injected inside the aggregation context so that only matching sub-documents are aggregated.
@@ -67,8 +93,8 @@ This release is compatible with Laravel 11, 12 & 13
67
93
68
94
### Added
69
95
70
-
-`Schema::compileMapping()`— compile a Blueprint callback into its resulting ES mapping structure without creating the index. Useful for debugging and previewing what `mappingDefinition()` will produce.
71
-
-`Grammar::compileMapping()`— public access to the Blueprint-to-properties compilation pipeline.
96
+
-`Schema::compileMapping()`- compile a Blueprint callback into its resulting ES mapping structure without creating the index. Useful for debugging and previewing what `mappingDefinition()` will produce.
97
+
-`Grammar::compileMapping()`- public access to the Blueprint-to-properties compilation pipeline.
72
98
73
99
### Fixed
74
100
@@ -86,7 +112,7 @@ This release is compatible with Laravel 10, 11 & 12
86
112
87
113
#### Automated Re-indexing Command
88
114
89
-
New `elastic:re-index` command that automates the entire re-indexing process when your field mappings change. Pass a model name and the command handles the rest — creating a temp index, copying data, verifying counts, swapping, and cleaning
115
+
New `elastic:re-index` command that automates the entire re-indexing process when your field mappings change. Pass a model name and the command handles the rest - creating a temp index, copying data, verifying counts, swapping, and cleaning
90
116
up across 9 interactive phases with confirmation prompts between each step. - [Docs](https://elasticsearch.pdphilip.com/schema/artisan-commands/#elasticre-index)
`groupByRanges()` performs a [range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-range-aggregation) on the specified
`groupByDateRanges()` performs a [date range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-daterange-aggregation) on the specified
0 commit comments