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
+79-12Lines changed: 79 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,14 +6,80 @@ All notable changes to this `laravel-elasticsearch` package will be documented i
6
6
7
7
This release is compatible with Laravel 10, 11 & 12
8
8
9
-
### Added
10
-
-**Auto-create index on first query** — When a model queries an index that doesn't exist yet, the index is created automatically instead of throwing `index_not_found_exception`. Matches Elasticsearch's own auto-create behavior for writes, extended to reads. Controlled via `options.auto_create_index` config (default: `true`)
11
-
-**Artisan commands** — `elastic:status`, `elastic:indices`, `elastic:show {index}` for connection health checks, index listing, and index inspection
12
-
-**`upsert()`** — Insert or update records by unique key in a single bulk operation, matching Laravel's native `upsert()` signature. Supports single and batch documents, specific update columns, and composite unique keys
13
-
-`TimeOrderedUUIDGenerator` — sortable 20-character IDs where lexicographic order matches chronological order across processes (millisecond granularity)
14
-
-`GeneratesTimeOrderedIds` trait with `getRecordTimestamp()` and `getRecordDate()` helpers — safe for mixed datasets (returns null for pre-existing non-time-ordered IDs)
15
-
- Schema Builder: `getIndexes()`, `getForeignKeys()`, `getViews()` for Laravel compatibility
16
-
- Test suite expanded from 379 to 422 tests (2,548 assertions), all passing. New coverage: upsert variations, advanced aggregations, filter context queries, DSL output inspection, point-in-time pagination, multi-match search, time-ordered IDs
9
+
[What's new in v5.4](https://elasticsearch.pdphilip.com/whats-new/#54-new-features)
10
+
11
+
### New features
12
+
13
+
#### Auto-Create Index
14
+
15
+
When a model queries an index that doesn't exist yet, the index is created automatically instead of throwing `index_not_found_exception`. Matches Elasticsearch's own auto-create behavior for writes, extended to reads.
16
+
17
+
```php
18
+
// No migration needed - index is created on first query
Controlled via `options.auto_create_index` config (default: `true`). - [Docs](https://elasticsearch.pdphilip.com/getting-started/)
23
+
24
+
Why: New models shouldn't crash before the first write. Elasticsearch already auto-creates on insert; this extends the same behavior to reads.
25
+
26
+
#### Artisan Commands
27
+
28
+
First-class CLI tools for managing your Elasticsearch connection and indices:
29
+
30
+
-`php artisan elastic:status` - Connection health check with cluster info and license details
31
+
-`php artisan elastic:indices` - List all indices with health, doc count, and store size
32
+
-`php artisan elastic:show {index}` - Inspect an index: overview, mappings, settings, and analysis config
33
+
34
+
```bash
35
+
php artisan elastic:status
36
+
php artisan elastic:indices --all
37
+
php artisan elastic:show products
38
+
```
39
+
40
+
All commands support `--connection=` for non-default connections.
41
+
42
+
Why: Until now, inspecting your Elasticsearch setup meant leaving Laravel for curl or Kibana. These commands bring that visibility into Artisan where it belongs.
43
+
44
+
#### Upsert
45
+
46
+
New `upsert()` method matching Laravel's native signature. Insert or update records by unique key in a single bulk operation. - [Docs](https://elasticsearch.pdphilip.com/eloquent/saving-models/#upsert)
Supports single documents, batch operations, and composite unique keys.
60
+
61
+
Why: Elasticsearch has no native upsert-by-field. This queries for existing documents first, then issues a single bulk request mixing index and update actions.
62
+
63
+
#### Time-Ordered IDs
64
+
65
+
New `GeneratesTimeOrderedIds` trait for sortable, chronologically-ordered IDs. 20 characters, URL-safe, lexicographic sort matches creation order across processes. - [Docs](https://elasticsearch.pdphilip.com/eloquent/the-base-model/#time-ordered-ids)
66
+
67
+
```php
68
+
use PDPhilip\Elasticsearch\Eloquent\GeneratesTimeOrderedIds;
@@ -23,16 +89,17 @@ This release is compatible with Laravel 10, 11 & 12
23
89
- Consolidated metadata handling into single `MetaDTO`
24
90
- Simplified `ManagesOptions` parameter inference
25
91
- Extracted `addFieldQuery()` dispatcher in `BuildsFieldQueries` to deduplicate field query methods
26
-
- Refactored Relations for readability: early returns, named variables, simplified loops across `MorphToMany`, `BelongsToMany`, `QueriesRelationships`, `InteractsWithPivotTable`, `ManagesManyToMany`
27
-
- Updated `ModelDocs` with comprehensive audit: corrected signatures, added missing methods, removed stale entries
28
-
- Added `declare(strict_types=1)` to all ID generation classes and traits
29
-
- Consolidated test ID strategy into `TestsWithIdStrategies` trait (removed duplicate `WithIds/` and `IdGenerated/` directories)
92
+
- Refactored Relations for readability: early returns, named variables, simplified loops
93
+
- Schema Builder: added `getIndexes()`, `getForeignKeys()`, `getViews()` for Laravel compatibility
30
94
- CI updated to Elasticsearch 8.18.0
95
+
- Test suite expanded from 379 to 422 tests (2,548 assertions), all passing
31
96
32
97
### Fixed
33
98
-`id` is now always present in serialized model output
0 commit comments