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
This release is compatible with Laravel 10, 11 & 12
50
+
51
+
#### 1. New feature, `withTrackTotalHits(bool|int|null $val = true)`
52
+
53
+
Appends the `track_total_hits` parameter to the DSL query, setting value to `true` will count all the hits embedded in the query meta not capping to Elasticsearch default of 10k hits
#### 2. New feature, `createOrFail(array $attributes)`
76
+
77
+
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
78
+
79
+
```php
80
+
Product::createOrFail([
81
+
'id' => 'some-existing-id',
82
+
'name' => 'Blender',
83
+
'price' => 30,
84
+
]);
85
+
86
+
87
+
```
88
+
#### 3. New feature `withRefresh(bool|string $refresh)`
89
+
90
+
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):
91
+
92
+
-`true` (default)
93
+
Refresh the relevant primary and replica shards (not the whole index) immediately after the operation occurs, so that the updated document appears in search results immediately.
94
+
-`wait_for`
95
+
Wait for the changes made by the request to be made visible by a refresh before replying. This doesn’t force an immediate refresh, rather, it waits for a refresh to happen.
96
+
-`false`
97
+
Take no refresh-related actions. The changes made by this request will be made visible at some point after the request returns.
98
+
99
+
```php
100
+
Product::withRefresh('wait_for')->create([
101
+
'name' => 'Blender',
102
+
'price' => 30,
103
+
]);
104
+
105
+
106
+
```
107
+
### PRS
108
+
109
+
* Add withTrackTotalHits method to Builder class to add track_total_hits by @caufab in https://github.com/pdphilip/laravel-elasticsearch/pull/76
110
+
* feat(query): add op_type=create support and dedupe helpers by @abkrim in https://github.com/pdphilip/laravel-elasticsearch/pull/79
111
+
112
+
### Bugfix
113
+
114
+
* Laravel ^12.23 Compatibility - close [#81](https://github.com/pdphilip/laravel-elasticsearch/issues/81)
115
+
116
+
### New Contributors
117
+
118
+
*@caufab made their first contribution in https://github.com/pdphilip/laravel-elasticsearch/pull/76
Copy file name to clipboardExpand all lines: src/Connection.php
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -123,6 +123,7 @@ private function sanitizeConfig(): void
123
123
'cert_password' => null,
124
124
],
125
125
'options' => [
126
+
'track_total_hits' => null, // null -> skips - max 10k by default; true -> full values; false -> no hit tracking, returns -1; int -> max hit tracking val, ex 20000
126
127
'bypass_map_validation' => false, // This skips the safety checks for Elastic Specific queries.
127
128
'logging' => false,
128
129
'ssl_verification' => true,
@@ -162,22 +163,24 @@ public function setOptions(): void
0 commit comments