From 555a638e3dd5a6398001b8853e7fd6da6352678e Mon Sep 17 00:00:00 2001 From: Oleg Zhulnev Date: Sun, 26 May 2024 22:34:41 +0300 Subject: [PATCH] Add UPGRADE-8.0 guide --- .gitattributes | 3 +- UPGRADE-8.0.md | 110 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 UPGRADE-8.0.md diff --git a/.gitattributes b/.gitattributes index e434b4d489..61e1bd2364 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/UPGRADE-8.0.md b/UPGRADE-8.0.md new file mode 100644 index 0000000000..4b37c5833c --- /dev/null +++ b/UPGRADE-8.0.md @@ -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', + ], + ]) + ```