Release notesedit


  • Updated the API endpoints to Elasticserach 8.14.0


  • Updated the API endpoints to Elasticserach 8.13.0
  • Added the Added the mapTo($class) function to Elasticsearch response for mapping the result of ES|QL query to an object of stdClass or a specific class #1398


  • Updated the API endpoints to Elasticserach 8.12.0
  • Tested the library with PHP 8.3


  • Updated the API endpoints to Elasticserach 8.11.0
  • Fixed path in hosts configuration is ignored #1377


  • Updated the API endpoints to Elasticserach 8.10.0


  • Updated the API endpoints to Elasticserach 8.9.0
  • Fixed issue with psr/http-message, changed PSR-7 versions to 1.1 and 2.0 #1344


  • Updated the API endpoints to Elasticserach 8.8.0
  • Added SearchHitIterators and SearchResponseIterator helpers revised with new version #1302


  • Updated the API endpoints to Elasticserach 8.7.0
  • Allow plugin for php-http/discovery library #1294


  • Updated the API endpoints to Elasticserach 8.6.0


  • Updated the API endpoints to Elasticserach 8.5.0


  • Added a ClientInterface to simplify the mock of the Client, this is a fix for #1227 #1249
  • Added the support of Symfony HTTP client, fixing the issue #1241 #1243
  • Added the API compatibility header #1233
  • Updated the API endpoints to Elasticserach 8.4.0


  • Updated the API endpoints to Elasticserach 8.3.0


  • Updated the API endpoints to Elasticserach 8.2.0
  • Added the array support for text/plain #1220


  • Updated the API endpoints to Elasticserach 8.1.0


  • use of NoNodeAvailableException exception in endpoints, fixing #1209


This new major version of elasticsearch-php contains a brand new implementation compared with 7.x. It supports PSR-7 for HTTP messages and PSR-18 for HTTP client communications. We used the elastic-transport-php library for HTTP communications.

We tried to reduce the BC breaks as much as possible with 7.x but there are some (big) differences:

  • we changed the namespace, now everything is under Elastic\Elasticsearch;
  • we changed the Exception model, using the namespace Elastic\Elasticsearch\Exception. All the exceptions extends the ElasticsearchException 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!

You can have a look at the BREAKING_CHANGES online document for more information.



  • Added support of includePortInHostHeader in ClientBuilder::fromConfig #1181
  • Fixed UTF-16 issue in SmartSerializer with single unpaired surrogate in unicode escape #1179
  • Replace trait with abstract class to avoid Deprecated Functionality issue in PHP 8.1 #1175


  • Updated endpoints for Elasticsearch 7.15.0 995f6d4


  • Usage of psr/log version 2 #1154
  • Update search iterators to send scroll_id inside the request body #1134
  • Added the ingest.geoip.downloader.enabled=false setting for ES 5867351
  • Removed phpcs for autogenerated files (endpoints) 651c57b


  • Added port in url for trace and logger messages #1126


  • (DOCS) Added the HTTP meta data section #1143
  • Added support for API Compatibility Header #1142
  • (DOCS) Added Helpers section to PHP book #1129
  • Added the API description in phpdoc section for each endpoint 9e05c81
  • Usage of PHPUnit 9 only + migrated xml configurations 038b5dd


  • Updated the endpoints for ES 7.12 + removed cpliakas/git-wrapper in favor of symplify/git-wrapper 136d5b9
  • Fixed warning header as array in YAML tests generator 0d81be1
  • Refactored TEST_SUITE with free, platinum + removed old YamlRunnerTest f69d96f


  • Added the X-Elastic-Client-Meta header which is used by Elastic Cloud and can be disabled with ClientBuilder::setElasticMetaHeader(false) #1089
  • Replaced array_walk with array_map in Connection::getURI for PHP 8 compatibility #1075
  • Remove unnecessary InvalidArgumentExceptions #1069
  • Introducing PHP 8 compatibility #1063
  • Replace Sami by Doctum and fix .gitignore #1062



  • Fixed using object instead of array in onFailure transport event #1066
  • Fixed reset custom header after endpoint call #1065
  • Show generic error messages when server returns no response #1056


  • Updated endpoints and namespaces for Elasticsearch 7.9 28bf0ed
  • Moved scroll_id into body for search operations in the documentation #1052
  • Fixed PHP 7.4 preloading feature for autoload.php #1051
  • Improved message of JSON errors using json_last_error_msg() #1045



  • Removed setId() into endpoints, fixed util/GenerateEndpoints.php #1026
  • Fixes JsonErrorException with code instead of message #1022
  • Better exception message for Could not parse URI #1016
  • Added JUnit log for PHPUnit 88b7e1c
  • Added the XPack endpoints 763d91a


  • Fixed issue with guzzlehttp/ringphp and guzzle/streams using forks ezimuel/ringphp and ezimuel/guzzlestreams 92a6a4a


  • Generated the new endpoints for Elasticsearch 7.6.0 be31f31


  • Fixes port missing in log #925 75e0888
  • Added ClientBuilder::includePortInHostHeader() to add the port in the Host header. This fixes #993. By default the port is not included in the Host header. #997
  • Replace abandoned packages: ringphp, streams and phpstan-shim #996
  • Fixed gzip compression when setting Cloud Id #986


  • Fixed Client::extractArgument iterable casting to array; this allows passing a Traversable body for some endpoints (for example, Bulk, Msearch, MsearchTemplate) #983
  • Fixed the Response Exception if the reason field is null #980
  • Added support for PHP 7.4 #976


  • We added the suppress operator @ for the deprecation messages @trigger_error(). With this approach, we don’t break existing application that convert PHP errors in Exception (for example, using Laravel with issue 297) Using the @ operator is still possible to intercept the deprecation message using a custom error handler. #973
  • Add missing leading slash in the URL of put mapping endpoint #970
  • Fix pre 7.2 endpoint class name with aliases + reapply fix #947. This PR solved the unexpected BC break introduce in 7.4.0 with the code generation tool #968



  • Added support for simplified access to the X-Opaque-Id header #952
  • Added the HTTP port in the log messages #950
  • Fixed hostname with underscore (ClientBuilder::prependMissingScheme) #949
  • Removed unused Monolog in ClientBuilder #948


  • Reintroduced the optional parameter in Elasticsearch\Namespaces\IndicesNamespace::getAliases(). This fixes the BC break introduced in 7.2.0 and 7.2.1. #947


  • Reintroduced Elasticsearch\Namespaces\IndicesNamespace::getAliases() as proxy to IndicesNamespace::getAlias() to prevent BC breaks. The getAliases() is marked as deprecated and it will be removed from elasticsearch-php 8.0 #943


  • Fixed missing put mapping code snippet in code examples #938


  • Updated the API endpoints for working with Elasticsearch 7.2.0:
  • added wait_for_active_shards parameter to indices.close API;
  • added expand_wildcards parameter to API;
  • added include_unloaded_segments`, expand_wildcards, forbid_closed_indices parameters to indices.stats API. 27d721b
  • Updated the phpdoc parameters for all the API endpoints 27d721b
  • Improved the Travis CI speed using cache feature with composer #929
  • Fixed php_uname() usage checking if it is disabled #927
  • Added support of Elastic Cloud ID and API key authentication #923


  • Fixed ClientBuilder::setSSLVerification() to accept string or boolean #917
  • Fix type hinting for setBody in Elasticsearch\Endpoints\Ingest\Pipeline\Put #913


  • Added warning log for Elasticsearch response containing the Warning header #911
  • Fixed #838 hosting company is blocking ports because of YamlRunnerTest.php #844
  • Specialized inheritance of NoNodesAvailableException to extend ServerErrorResponseException instead of the generic \Exception #607
  • Fixed scroll TTL is extracted but not set as a body param #907


  • Improved the speed of integration tests removing snapshots delete from YamlRunnerTest::clean #911
  • Reduced the number of skipping YAML integration tests from 20 to 6 #911


  • Documentation updated for Elasticsearch 7 #904


  • Fixed incorrect return type hint when using async requests/futures #905


  • Fixed SniffingConnectionPool removing the return type of Connection::sniff() #899


  • Requirement of PHP 7.1 instead of 7.0 that is not supported since 1 Jan 2019. #897
  • Code refactoring using type hints and return type declarations where possible #897
  • Update vendor libraries (PHPUnit 7.5, Symfony YAML 4.3, and so on) #897
  • Updated all the API endpoints using the latest 7.0.0 specs of Elasticsearch #897
  • Added the User-Agent in each HTTP request #898
  • Simplified the logging methods logRequestFail($request, $response, $exception) and logRequestSuccess($request, $response) in Elasticsearch\Connections\Connection #876
  • Fix json_encode for unicode(emoji) characters #856
  • Fix HTTP port specification using CURLOPT_PORT, not anymore in the host #782