This is a major release with breaking changes that require code updates.
- Minimum PHP version: 8.1 (previously 8.0)
- Maximum PHP version: 8.5 (newly supported)
- Elasticsearch compatibility: 9.0+ (previously 8.x)
The template API has been significantly reworked to align with Elasticsearch's new template system.
Elastica\IndexTemplate now works only with the new _index_template API.
Before
use Elastica\IndexTemplate;
$template = new IndexTemplate($client, 'my-template');
$template->setBody(['settings' => ['number_of_shards' => 1]]);
$template->create();After
use Elastica\IndexTemplate;
$template = new IndexTemplate($client, 'my-template');
$template->setBody(['index_patterns' => ['my-*'], 'template' => ['settings' => ['number_of_shards' => 1]]]);
$template->create();For legacy template API support, use the new Elastica\Template class.
Before
use Elastica\IndexTemplate;
$template = new IndexTemplate($client, 'my-template');
// Using deprecated template APIAfter
use Elastica\Template;
$template = new Template($client, 'my-template');
// Uses legacy template APIElastica\ComponentTemplate- For component templatesElastica\IndexTemplate- For index templates (new API)Elastica\Template- For legacy templates
The search() and count() methods in SearchableInterface have been simplified.
Before
$search = $index->search($query, $options, 'GET');
$count = $index->count($query, $options, 'GET');After
$search = $index->search($query, $options);
$count = $index->count($query, $options);Affected classes: Elastica\Search and Elastica\Index
Elastica\Request- Constants are no longer used and the class is not needed
Before
use Elastica\Request;
$method = Request::GET;After
// Use string literals directly
$method = 'GET';- Minimum PHP version: 8.1 (increased from 8.0)
- Maximum PHP version: 8.5 (newly supported)
Update your composer.json:
Before
{
"require": {
"php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0"
}
}After
{
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0"
}
}- PHPUnit: Upgraded from 9.5 to 10.5
- PHPStan: Updated to 2.x
If you have custom test configurations, update them accordingly.
- Update PHP version to 8.1+ (remove PHP 8.0 support)
- Update Elasticsearch to 9.0+
- Review template usage and migrate to new API if needed
- Remove third parameter from
search()andcount()method calls - Replace
Elastica\Requestconstants with string literals - Update test configurations for PHPUnit 10.5
- Update static analysis tools to PHPStan 2.x
- PHP 8.0 support dropped - Minimum PHP version is now 8.1
- Template API changes -
IndexTemplatenow uses new API, useTemplatefor legacy - Method signature changes - Removed unused
$methodparameter from search methods - Removed classes -
Elastica\Requestclass no longer exists - Elasticsearch 9.0+ required - No longer compatible with Elasticsearch 8.x
For detailed information about all changes, see the CHANGELOG.md.