Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ jobs:
tools: 'composer:v2'
php-cs-fixer: false

- php-version: '8.5'
elasticsearch-version: '8.14.3'
elasticsearch-package-constraint: '~7.17.0'
minimum-stability: 'dev'
dependency-versions: 'highest'
tools: 'composer:v2'
php-cs-fixer: false

services:
elasticsearch:
image: elasticsearch:${{ matrix.elasticsearch-version }}
Expand Down
1 change: 1 addition & 0 deletions Resources/config/adapter_elastic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<argument type="collection">
<argument key="hosts">%massive_search.adapter.elastic.hosts%</argument>
<argument key="version">%massive_search.adapter.elastic.version%</argument>
</argument>
</service>
<service id="massive_search.adapter.elastic" class="%massive_search.search.adapter.elastic.class%" public="true">
Expand Down
18 changes: 17 additions & 1 deletion Search/Adapter/Elastic/ClientFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ class ClientFactory
*/
public static function create($config)
{
return ClientBuilder::create()->setHosts($config['hosts'])->build();
$clientBuilder = ClientBuilder::create()->setHosts($config['hosts']);

$elasticSearchVersion = defined(Client::class . '::VERSION') ? Client::VERSION : '5.0';
$version = $config['version'] ?? $elasticSearchVersion;

if (\version_compare($version, '7.11.0', '>=')) {
$clientBuilder->setConnectionParams([
'client' => [
'headers' => [
'Accept' => ['application/vnd.elasticsearch+json;compatible-with=7'],
'Content-Type' => ['application/vnd.elasticsearch+json;compatible-with=7'],
],
],
]);
}

return $clientBuilder->build();
}
}
19 changes: 19 additions & 0 deletions Tests/docker/docker-elasticsearch-8-19.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.19.0
environment:
discovery.type: single-node
xpack.security.enabled: 'false'
cluster.routing.allocation.disk.threshold_enabled: 'false'
ports:
- "9200:9200"
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
interval: 5s
timeout: 5s
retries: 20
volumes:
- elasticsearch-data:/usr/share/elasticsearch/data

volumes:
elasticsearch-data:
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
"conflict": {
"guzzlehttp/ringphp": "< 1.0.7",
"symfony/security-guard": "5.4.0-BETA1",
"doctrine/doctrine-cache-bundle": "<1.3.1"
"doctrine/doctrine-cache-bundle": "<1.3.1",
"elasticsearch/elasticsearch": "<2.0 || >=8.0"
},
"autoload": {
"psr-4": {
Expand Down
Loading