Skip to content

Commit 3ca142f

Browse files
chore: prepare version 2.0 (#200)
Latests fixes on the documentation.
1 parent ef0cb9b commit 3ca142f

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Main features:
1919
> [!IMPORTANT]
2020
> Require PHP 8.0+ and Elasticsearch 8+.
2121
22-
Works with **Elasticsearch 7** as well but is not officially supported by Elastica 8. Use with caution.
22+
Works with **Elasticsearch 7** as well, but is not officially supported by Elastica 8. Use with caution.
2323

2424
Version 2+ does not work with **OpenSearch** anymore due to restrictions added by Elastic on their client.
2525

@@ -249,7 +249,9 @@ Then configure the bundle:
249249
# config/packages/elastically.yaml
250250
elastically:
251251
connections:
252+
# You can create multiple clients
252253
default:
254+
# Any Elastica option works here
253255
client:
254256
hosts:
255257
- '127.0.0.1:9200'
@@ -272,6 +274,10 @@ elastically:
272274
273275
# If you want to add a prefix for your index in elasticsearch (you can still call it by its base name everywhere!)
274276
# prefix: '%kernel.environment%'
277+
278+
# Use HttpClient component
279+
transport_config:
280+
http_client: 'Psr\Http\Client\ClientInterface'
275281
```
276282

277283
Finally, inject one of those service (autowirable) in you code where you need
@@ -340,8 +346,8 @@ JoliCode\Elastically\Client:
340346
$config:
341347
hosts:
342348
- '127.0.0.1:9200'
343-
transport_client:
344-
client: '@my_custom_psr18_client' # An instance of Symfony\Component\HttpClient\Psr18Client (Or any PSR 18 compliant one)
349+
transport_config:
350+
http_client: 'Psr\Http\Client\ClientInterface'
345351
```
346352

347353
See the [official documentation on how to get a PSR-18 client](https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17).
@@ -440,7 +446,6 @@ $factory = new Factory([
440446

441447
- some "todo" in the code
442448
- optional Doctrine connector
443-
- better logger - maybe via a processor? extending _log is supposed to be deprecated :(
444449
- extra commands to monitor, update mapping, reindex... Commonly implemented tasks
445450
- optional Symfony integration:
446451
- web debug toolbar!

UPGRADE.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
## From v1.9.0 to v2.0.0
44

5+
> [!WARNING]
6+
> All the deprecation from Elastica 7 to Elastica 8 apply to this major version,
7+
> [see their UPGRADE first](https://github.com/ruflin/Elastica/blob/58042887616eeb63621412c03bc903056bbcee7e/UPGRADE-8.0.md#upgrade-from-73-to-80).
8+
59
HttpClientTransport has been removed, you must replace it with [a PSR-18 client](https://symfony.com/doc/current/http_client.html#psr-18-and-psr-17):
610

711
```diff
8-
JoliCode\Elastically\Client:
9-
arguments:
10-
$config:
11-
host: '%env(ELASTICSEARCH_HOST)%'
12-
port: '%env(ELASTICSEARCH_PORT)%'
13-
- transport: '@JoliCode\Elastically\Transport\HttpClientTransport'
14-
+ transport_client:
15-
+ client: '@my_custom_psr18_client' # An instance of Symfony\Component\HttpClient\Psr18Client (Or any PSR 18 compliant one)
12+
- transport: '@JoliCode\Elastically\Transport\HttpClientTransport'
13+
+ transport_config:
14+
+ http_client: 'Psr\Http\Client\ClientInterface'
1615
```
1716

1817
Code has been cleaned of deprecations:
@@ -37,7 +36,7 @@ Code has been cleaned of deprecations:
3736
- Removed `\JoliCode\Elastically\Client::getDenormalizer`, use the Factory (`\JoliCode\Elastically\Factory`) or DIC
3837
- Removed `\JoliCode\Elastically\Client::getSerializerContext`, use the Factory (`\JoliCode\Elastically\Factory`) or DIC
3938
- Using `\Elastica\Document::setData` to store your DTO will not work anymore, you must use `\JoliCode\Elastically\Model\Document` instead
40-
-
39+
4140
## From v1.3.0 to v1.4.0
4241

4342
If you're using Symfony, here are the changes to apply:

src/Bridge/Symfony/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function getConfigTreeBuilder(): TreeBuilder
3131
->arrayNode('client')
3232
->info('All options for the Elastica client constructor')
3333
->example([
34-
'host' => '%env(ELASTICSEARCH_HOST)%',
34+
'hosts' => ['%env(ELASTICSEARCH_HOST)%', 'http://localhost:9200'],
3535
])
3636
->normalizeKeys(false)
3737
->defaultValue([])

0 commit comments

Comments
 (0)