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
+49-36Lines changed: 49 additions & 36 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,11 +9,6 @@ All notable changes to this `laravel-elasticsearch` package will be documented i
9
9
-`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.
10
10
-`Grammar::compileMapping()` — public access to the Blueprint-to-properties compilation pipeline.
11
11
12
-
### Improved
13
-
14
-
-`elastic:re-index` mapping analysis now uses `getMappings()` + `compileMapping()` for a proper apples-to-apples comparison, replacing the manual tree-building approach. Correctly handles nested types with properties, multi-field types with sub-fields, and any combination at any depth.
15
-
-`elastic:re-index` output uses `dataList` depth rendering for both "Fields to Update" and "Unmapped Fields", showing nested structures with proper indentation.
16
-
17
12
### Fixed
18
13
19
14
-`elastic:re-index` now correctly detects nested field mappings (e.g., `nested('tags')->properties(...)`) including their sub-fields and keyword sub-field changes.
@@ -30,14 +25,16 @@ This release is compatible with Laravel 10, 11 & 12
30
25
31
26
#### Automated Re-indexing Command
32
27
33
-
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 up across 9 interactive phases with confirmation prompts between each step. - [Docs](https://elasticsearch.pdphilip.com/schema/artisan-commands/#elasticre-index)
28
+
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
29
+
up across 9 interactive phases with confirmation prompts between each step. - [Docs](https://elasticsearch.pdphilip.com/schema/artisan-commands/#elasticre-index)
Define your index field mappings directly on the model by overriding `mappingDefinition()`. Uses the same Blueprint syntax as migrations. Powers the `elastic:re-index` command's mapping analysis. - [Docs](https://elasticsearch.pdphilip.com/eloquent/the-base-model/#mapping-definition)
54
+
Define your index field mappings directly on the model by overriding `mappingDefinition()`. Uses the same Blueprint syntax as migrations. Powers the `elastic:re-index` command's mapping
public static function mappingDefinition(Blueprint $index): void
@@ -141,7 +139,8 @@ Why: Elasticsearch has no native upsert-by-field. This queries for existing docu
141
139
142
140
#### Time-Ordered IDs
143
141
144
-
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)
142
+
New `GeneratesTimeOrderedIds` trait for sortable, chronologically-ordered IDs. 20 characters, URL-safe, lexicographic sort matches creation order across
Why: Massive performance gains vs running sequential distinct queries.
219
222
220
223
#### Group By Ranges
221
224
222
-
`groupByRanges()` performs a [range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-range-aggregation) on the specified field. - [Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/#groupby-ranges)
225
+
`groupByRanges()` performs a [range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-range-aggregation) on the specified
`groupByRanges()->agg()` - apply metric aggregations per bucket -[Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/#groupby-ranges-with-aggregations)
230
+
`groupByRanges()->agg()` - apply metric aggregations per bucket -[Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/#groupby-ranges-with-aggregations)
227
231
228
232
#### Group By Date Ranges
229
233
230
-
`groupByDateRanges()` performs a [date range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-daterange-aggregation) on the specified field. - [Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/#groupby-date-ranges)
234
+
`groupByDateRanges()` performs a [date range aggregation](https://www.elastic.co/docs/reference/aggregations/search-aggregations-bucket-daterange-aggregation) on the specified
When a bucketed query is executed, the raw bucket data is now stored in model meta. -[Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/#raw-bucket-values-from-meta)
This can be set by default for all queries by updating the connection config in `database.php`:
320
330
321
331
```php
@@ -331,6 +341,7 @@ This can be set by default for all queries by updating the connection config in
331
341
332
342
333
343
```
344
+
334
345
#### 2. New feature, `createOrFail(array $attributes)`
335
346
336
347
By default, when using `create($attributes)` where `$attributes `has an `id` that exists, the operation will upsert. `createOrFail` will throw a `BulkInsertQueryException` with status code `409` if the `id` exists
@@ -345,6 +356,7 @@ Product::createOrFail([
345
356
346
357
347
358
```
359
+
348
360
#### 3. New feature `withRefresh(bool|string $refresh)`
349
361
350
362
By default, inserting documents will wait for the shards to refresh, ie: `withRefresh(true)`, you can set the refresh flag with the following (as per ES docs):
@@ -530,9 +545,8 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
530
545
### Upgrading
531
546
532
547
- Please take a look at the [upgrade guide](https://elasticsearch.pdphilip.com/upgrade-guide/) carefully, as there are several significant breaking changes.
533
-
548
+
534
549
-[New features are detailed here](https://elasticsearch.pdphilip.com/whats-new/)
535
-
536
550
537
551
```json
538
552
"pdphilip/elasticsearch": "^5",
@@ -544,6 +558,7 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
544
558
545
559
546
560
```
561
+
547
562
### Breaking Changes
548
563
549
564
#### 1. Connection
@@ -558,10 +573,10 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
558
573
-**Model ID Field**
559
574
`$model->_id` is deprecated. Use `$model->id` instead.
560
575
If your model had a separate `id` field, you must rename it.
561
-
576
+
562
577
-**Default Limit Constant**
563
578
`MAX_SIZE` constant is removed. Use `$defaultLimit` property:
564
-
579
+
565
580
```php
566
581
use PDPhilip\Elasticsearch\Eloquent\Model;
567
582
@@ -582,9 +597,9 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
582
597
#### 3. Queries
583
598
584
599
-`where()` Behavior Changed
585
-
600
+
586
601
Now uses term query instead of match.
587
-
602
+
588
603
```php
589
604
// Old:
590
605
Product::where('name', 'John')->get(); // match query
@@ -600,13 +615,13 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
600
615
601
616
```
602
617
-`orderByRandom()` Removed
603
-
618
+
604
619
Replace with `functionScore()`[Docs](https://elasticsearch.pdphilip.com/upgrade-guide#queries)
605
-
620
+
606
621
- Full-text Search Options Updated
607
622
Methods like `asFuzzy()`, `setMinShouldMatch()`, `setBoost()` removed.
608
623
Use callback-based SearchOptions instead:
609
-
624
+
610
625
```php
611
626
Product::searchTerm('espresso time', function (SearchOptions $options) {
612
627
$options->searchFuzzy();
@@ -623,19 +638,17 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
623
638
```
624
639
- Legacy Search Methods Removed
625
640
All `{xx}->search()` methods been removed. Use `{multi_match}->get()` instead.
626
-
627
641
628
642
#### 4. Distinct & GroupBy
629
643
630
644
-`distinct()` and `groupBy()` behavior updated. [Docs](https://elasticsearch.pdphilip.com/eloquent/distinct/)
631
-
645
+
632
646
Review queries using them and refactor accordingly.
633
-
634
647
635
648
#### 5. Schema
636
649
637
650
-`IndexBlueprint` and `AnalyzerBlueprint` has been removed and replaced with a single `Blueprint` class
638
-
651
+
639
652
```diff
640
653
- use PDPhilip\Elasticsearch\Schema\IndexBlueprint;
641
654
- use PDPhilip\Elasticsearch\Schema\AnalyzerBlueprint;
@@ -649,25 +662,24 @@ with Laravel’s Eloquent. It lays a solid, future-proof foundation for everythi
649
662
650
663
```
651
664
-`Schema::hasIndex` has been removed. Use `Schema::hasTable` or `Schema::indexExists` instead.
652
-
665
+
653
666
-`geo($field)` field property has been replaced with `geoPoint($field)`
654
-
667
+
655
668
-`{field}->index($bool)` field property has been replaced with `{field}->indexField($bool)`;
656
-
669
+
657
670
-`alias()` field type has been removed. Use `aliasField()` instead.
658
-
671
+
659
672
-`settings()` method has been replaced with `withSetting()`
660
-
673
+
661
674
-`map()` method has been replaced with `withMapping()`
662
-
675
+
663
676
-`analyzer()` method has been replaced with `addAnalyzer()`
664
-
677
+
665
678
-`tokenizer()` method has been replaced with `addTokenizer()`
666
-
679
+
667
680
-`charFilter()` method has been replaced with `addCharFilter()`
668
-
681
+
669
682
-`filter()` method has been replaced with `addFilter()`
0 commit comments