Skip to content

Commit

Permalink
Add UPGRADE-8.0 guide (#2214)
Browse files Browse the repository at this point in the history
  • Loading branch information
sidz authored May 28, 2024
1 parent 7446c55 commit f29780f
Show file tree
Hide file tree
Showing 2 changed files with 112 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
/.gitignore export-ignore
/.php-cs-fixer.dist.php export-ignore
/CHANGELOG.md merge=union
/codecov.yml export-ignore
/CONTRIBUTING.md export-ignore
/UPGRADE-8.0.md export-ignore
/codecov.yml export-ignore
/docker export-ignore
/Makefile export-ignore
/phive.xml export-ignore
Expand Down
110 changes: 110 additions & 0 deletions UPGRADE-8.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
UPGRADE FROM 7.3 to 8.0
=======================

Client configuration has been significantly reworked.
Elastica rely on official elasticsearch PHP client parameters now.

Client
-------
* `host` parameter has been renamed to `hosts` and it's type has been set to array
*Before*
```php
new Elastica\Elastica([
'host' => 'http://es.host.com',
])
```

*After*
```php
new Elastica\Elastica([
'hosts' => ['http://es.host.com'],
])
```

* `port` parameter has been removed.
*Before*
```php
new Elastica\Elastica([
'host' => 'http://es.host.com',
'port' => 9200,
])
```

*After*
```php
new Elastica\Elastica([
'hosts' => ['http://es.host.com:9200'],
])
```

* `url` no longer supported in favor of `hosts`
*Before*
```php
new Elastica\Elastica([
'url' => 'http://es.host.com',
])
```

*After*
```php
new Elastica\Elastica([
'hosts' => ['http://es.host.com'],
])
```

* `roundRobin` parameter has been removed
*Before*
```php
new Elastica\Elastica([
'url' => 'http://es.host.com',
'roundRobin' => true,
])
```

*After*
```php
use Elastic\Transport\NodePool\Resurrect\ElasticsearchResurrect;
use Elastic\Transport\NodePool\Selector\RoundRobin;
use Elastic\Transport\NodePool\SimpleNodePool;

$nodePool = new SimpleNodePool(
new RoundRobin(),
new ElasticsearchResurrect()
);

new Client([
'hosts' => [
'https://es.host.com:9200',
],
'transport_config' => [
'node_pool' => $nodePool,
],
]);
```

* `connections` parameter has been removed.
*Before*
```php
new Elastica\Elastica([
'connections' => [
[
'host' => 'https://es.node1.com',
'port' => 9200,
],
[
'host' => 'https://es.node2.com',
'port' => 9200,
],
],
])
```

*After*
```php
new Elastica\Elastica([
'hosts' => [
'http://es.host.com',
'https://es.node2.com',
],
])
```

0 comments on commit f29780f

Please sign in to comment.