|
1 | 1 | [[breaking_changes]]
|
2 |
| -=== Breaking changes from 6.x |
| 2 | +=== Breaking changes from 7.x |
3 | 3 |
|
4 |
| -[discrete] |
5 |
| -==== E_USER_DEPRECATED notice when using deprecated parameters |
6 |
| - |
7 |
| -Starting from elasticsearch-php 7.4.0, we generate a PHP |
8 |
| -https://www.php.net/manual/en/errorfunc.constants.php[E_USER_DEPRECATED] notice |
9 |
| -every time you use a deprecated parameters for {es}. We decided to add this |
10 |
| -notice to facilitate the code refactoring with the new API specification of {es} |
11 |
| -(for example the usage of typeless APIs, see below). |
12 |
| - |
13 |
| -From 7.4.1, we mitigated the usage of E_USER_DEPRICATED warning by using the `@` |
14 |
| -https://www.php.net/manual/en/language.operators.errorcontrol.php[operator]. The |
15 |
| -operator suppresses the error message, however, it is still possible to catch it |
16 |
| -by using a custom error handler: |
17 |
| - |
18 |
| -[source,php] |
19 |
| ----- |
20 |
| -set_error_handler(function ($errno, $errstr) { |
21 |
| - var_dump($errstr); |
22 |
| -}, E_USER_DEPRECATED); |
23 |
| -
|
24 |
| -@trigger_error('Deprecation message here', E_USER_DEPRECATED); |
25 |
| ----- |
| 4 | +This major release is a complete new PHP client for {es}. We build it from scratch! |
| 5 | +We tried to reduce the BC breaks as much as possible but there are some (big) differences: |
26 | 6 |
|
27 | 7 | [discrete]
|
28 |
| -==== Moving from types to typeless APIs in {es} 7.0 |
| 8 | +==== Architectural changes |
29 | 9 |
|
30 |
| -{es} 7.0 deprecated APIs that accept types, introduced new typeless APIs, and |
31 |
| -removed support for the _default_ mapping. Read |
32 |
| -https://www.elastic.co/blog/moving-from-types-to-typeless-apis-in-elasticsearch-7-0[this] |
33 |
| -blog post for more information. |
| 10 | +- we changed the namespace, now everything is under `Elastic\Elasticsearch` |
| 11 | +- we used the https://github.com/elastic/elastic-transport-php[elastic-transport-php] library for HTTP communications; |
| 12 | +- we changed the `Exception` model, using the namespace `Elastic\Elasticsearch\Exception`. All the exceptions extends the |
| 13 | + `ElasticsearchException` interface, as in 7.x |
| 14 | +- we changed the response type of each endpoint using an https://github.com/elastic/elasticsearch-php/blob/master/src/Response/Elasticsearch.php[Elasticsearch] response class. |
| 15 | + This class wraps a https://www.php-fig.org/psr/psr-7/[PSR-7] response allowing the access of the body response |
| 16 | + as array or object. This means you can access the API response as in 7.x, no BC break here! :angel: |
| 17 | +- we changed the `ConnectionPool` in `NodePool`. The `connection` naming was ambigous since the objects are nodes (hosts) |
34 | 18 |
|
35 | 19 | [discrete]
|
36 |
| -==== Type hint and return type |
37 |
| - |
38 |
| -Added type hints and return type declarations in all the code base where |
39 |
| -possible. See PR https://github.com/elastic/elasticsearch-php/pull/897[#897]. |
40 |
| - |
41 |
| -[discrete] |
42 |
| -==== PHP 7.1+ Requirement |
43 |
| - |
44 |
| -We require using PHP 7.1+ for elasticsearch-php. PHP 7.0 is not supported since |
45 |
| -1st Jan 2019. Refer |
46 |
| -https://www.php.net/supported-versions.php[PHP supported version] for more |
47 |
| -information. |
| 20 | +==== Specific changes |
| 21 | + |
| 22 | +The following functions has been removed: |
| 23 | + |
| 24 | +- `ClientBuilder::getEndpoint()` |
| 25 | +- `ClientBuilder::getRegisteredNamespacesBuilders()` |
| 26 | +- `ClientBuilder::getRegisteredNamespacesBuilders()` |
| 27 | +- `ClientBuilder::defaultHandler()` |
| 28 | +- `ClientBuilder::multiHandler()` |
| 29 | +- `ClientBuilder::singleHandler()` |
| 30 | +- `ClientBuilder::setConnectionFactory()` |
| 31 | +- `ClientBuilder::setConnectionPool()`, you can use `ClientBuilder::setNodePool` instead |
| 32 | +- `ClientBuilder::setEndpoint()` |
| 33 | +- `ClientBuilder::registerNamespace()` |
| 34 | +- `ClientBuilder::setTransport()`, you can specify an HTTP PSR-18 client using `ClientBuilder::setHttpClient()` |
| 35 | +- `ClientBuilder::setHandler()` |
| 36 | +- `ClientBuilder::setTracer()`, you can only set a Logger using `ClientBuilder::setLogger()` |
| 37 | +- `ClientBuilder::setSerializer()` |
| 38 | +- `ClientBuilder::setConnectionParams()`, you can use `ClientBuilder::setHttpClientOptions()` instead |
| 39 | +- `ClientBuilder::setSelector()`, you can set a `Selector` using the `setNodePool`, see [here](https://github.com/elastic/elastic-transport-php/blob/8.x/README.md#use-a-custom-selector) for more information |
| 40 | +- `ClientBuilder::setSniffOnStart()` |
| 41 | +- `ClientBuilder::includePortInHostHeader()` |
| 42 | + |
| 43 | +We removed the special `client` parameter passed in `$params` endpoints. In details: |
| 44 | + |
| 45 | +- `$params['client']['never_retry']` |
| 46 | +- `$params['client']['verbose']` |
| 47 | +- `$params['client']['port_in_header']` |
| 48 | +- `$params['client']['future']`, you can set HTTP async using `Client::setAsync(true)` |
| 49 | +- `$params['client']['ignore']`, you can disable the Exception using `Client::setResponseException(false)` |
0 commit comments