This major release is a complete new PHP client for Elasticsearch. We build it from scratch! We tried to reduce the BC breaks as much as possible but there are some (big) differences:
- we changed the namespace, now everything is under
Elastic\Elasticsearch
- we used the elastic-transport-php library for HTTP communications;
- we changed the
Exception
model, using the namespaceElastic\Elasticsearch\Exception
. All the exceptions extends theElasticsearchException
interface, as in 7.x - we changed the response type of each endpoints using an Elasticsearch response class. This class wraps a a PSR-7 response allowing the access of the body response as array or object. This means you can access the API response as in 7.x, no BC break here! 👼
- we changed the
ConnectionPool
inNodePool
. Theconnection
naming was ambigous since the objects are nodes (hosts)
The following functions has been removed:
ClientBuilder::getEndpoint()
ClientBuilder::getRegisteredNamespacesBuilders()
ClientBuilder::getRegisteredNamespacesBuilders()
ClientBuilder::defaultHandler()
ClientBuilder::multiHandler()
ClientBuilder::singleHandler()
ClientBuilder::setConnectionFactory()
ClientBuilder::setConnectionPool()
, you can useClientBuilder::setNodePool
insteadClientBuilder::setEndpoint()
ClientBuilder::registerNamespace()
ClientBuilder::setTransport()
, you can specify an HTTP PSR-18 client usingClientBuilder::setHttpClient()
ClientBuilder::setHandler()
ClientBuilder::setTracer()
, you can only set a Logger usingClientBuilder::setLogger()
ClientBuilder::setSerializer()
ClientBuilder::setConnectionParams()
, you can useClientBuilder::setHttpClientOptions()
insteadClientBuilder::setSelector()
, you can set aSelector
using thesetNodePool
, see here for more informationClientBuilder::setSniffOnStart()
ClientBuilder::includePortInHostHeader()
We removed the special client
parameter passed in $params
endpoints. In details:
$params['client']['never_retry']
$params['client']['verbose']
$params['client']['port_in_header']
$params['client']['future']
, you can set HTTP async usingClient::setAsync(true)
$params['client']['ignore']
, you can disable the Exception usingClient::setResponseException(false)
- We changed the signature of
Elasticsearch\Common\EmptyLogger::log
adding thevoid
return type. This change has been needed to support psr/log v3.
- Using a deprecated parameter is notified triggering a E_USER_DEPRECATED
error (e.g. using the
type
parameter will generate aSpecifying types in urls has been deprecated
deprecation message). - When
delete
with an emptyid
anElasticsearch\Common\Exceptions\RuntimeException\Missing404Exception
exception is thrown. Previously it was aElasticsearch\Common\Exceptions\RuntimeException\InvalidArgumentException
.
-
Requirement of PHP 7.1 instead of 7.0 that is not supported since 1 Jan 2019. See PHP supported version for more information.
-
Elasticsearch 7.0 deprecated APIs that accept types, introduced new typeless APIs, and removed support for the default mapping. Read this blog post for more information.
-
Added type hints and return type declarations where possible #897
- Method taskList() renamed to list() in TasksNamespace
{type}
part inindices.put_mapping
API is not required anymore, see new specification here
-
[Search Templates]: PutTemplate endpoint has been removed (see Elasticsearch Breaking Changes), use PutScript instead.
-
#674
ClientBuilder::defaultLogger()
method was removed. It is recommended to create the logger object manually.