BREAKING_CHANGES.md
elasticsearch-php client requires PHP 8.1+.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:
Elastic\ElasticsearchException model, using the namespace Elastic\Elasticsearch\Exception. All the exceptions extends the
ElasticsearchException interface, as in 7.xConnectionPool in NodePool. The connection 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 use ClientBuilder::setNodePool insteadClientBuilder::setEndpoint()ClientBuilder::registerNamespace()ClientBuilder::setTransport(), you can specify an HTTP PSR-18 client using ClientBuilder::setHttpClient()ClientBuilder::setHandler()ClientBuilder::setTracer(), you can only set a Logger using ClientBuilder::setLogger()ClientBuilder::setSerializer()ClientBuilder::setConnectionParams(), you can use ClientBuilder::setHttpClientOptions() insteadClientBuilder::setSelector(), you can set a Selector using the setNodePool, 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 using Client::setAsync(true)$params['client']['ignore'], you can disable the Exception using Client::setResponseException(false)Elasticsearch\Common\EmptyLogger::log adding the void return type.
This change has been needed to support psr/log v3.type parameter will generate a Specifying types in urls has been deprecated
deprecation message).delete with an empty id an Elasticsearch\Common\Exceptions\RuntimeException\Missing404Exception
exception is thrown. Previously it was a Elasticsearch\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
{type} part in indices.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.