Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: prepare version 2.0 #200

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Main features:
> [!IMPORTANT]
> Require PHP 8.0+ and Elasticsearch 8+.

Works with **Elasticsearch 7** as well but is not officially supported by Elastica 8. Use with caution.
Works with **Elasticsearch 7** as well, but is not officially supported by Elastica 8. Use with caution.

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

Expand Down Expand Up @@ -249,7 +249,9 @@ Then configure the bundle:
# config/packages/elastically.yaml
elastically:
connections:
# You can create multiple clients
default:
# Any Elastica option works here
client:
hosts:
- '127.0.0.1:9200'
Expand All @@ -272,6 +274,10 @@ elastically:

# If you want to add a prefix for your index in elasticsearch (you can still call it by its base name everywhere!)
# prefix: '%kernel.environment%'

# Use HttpClient component
transport_config:
http_client: 'Psr\Http\Client\ClientInterface'
```

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

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).
Expand Down Expand Up @@ -440,7 +446,6 @@ $factory = new Factory([

- some "todo" in the code
- optional Doctrine connector
- better logger - maybe via a processor? extending _log is supposed to be deprecated :(
- extra commands to monitor, update mapping, reindex... Commonly implemented tasks
- optional Symfony integration:
- web debug toolbar!
Expand Down
17 changes: 8 additions & 9 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@

## From v1.9.0 to v2.0.0

> [!WARNING]
> All the deprecation from Elastica 7 to Elastica 8 apply to this major version,
> [see their UPGRADE first](https://github.com/ruflin/Elastica/blob/58042887616eeb63621412c03bc903056bbcee7e/UPGRADE-8.0.md#upgrade-from-73-to-80).

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):

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

Code has been cleaned of deprecations:
Expand All @@ -37,7 +36,7 @@ Code has been cleaned of deprecations:
- Removed `\JoliCode\Elastically\Client::getDenormalizer`, use the Factory (`\JoliCode\Elastically\Factory`) or DIC
- Removed `\JoliCode\Elastically\Client::getSerializerContext`, use the Factory (`\JoliCode\Elastically\Factory`) or DIC
- Using `\Elastica\Document::setData` to store your DTO will not work anymore, you must use `\JoliCode\Elastically\Model\Document` instead
-

## From v1.3.0 to v1.4.0

If you're using Symfony, here are the changes to apply:
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Symfony/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->arrayNode('client')
->info('All options for the Elastica client constructor')
->example([
'host' => '%env(ELASTICSEARCH_HOST)%',
'hosts' => ['%env(ELASTICSEARCH_HOST)%', 'http://localhost:9200'],
])
->normalizeKeys(false)
->defaultValue([])
Expand Down