diff --git a/.github/workflows/test-application.yaml b/.github/workflows/test-application.yaml index d8d89120..e357698d 100644 --- a/.github/workflows/test-application.yaml +++ b/.github/workflows/test-application.yaml @@ -84,6 +84,16 @@ jobs: php-cs-fixer: false max-phpunit-version: '8' + - php-version: '8.4' + elasticsearch-version: '8.14.3' + elasticsearch-package-constraint: '~7.17.0' + minimum-stability: 'dev' + dependency-versions: 'highest' + tools: 'composer:v2' + php-cs-fixer: false + max-phpunit-version: '8' + composer-options: '--ignore-platform-reqs' + services: elasticsearch: image: elasticsearch:${{ matrix.elasticsearch-version }} @@ -114,6 +124,7 @@ jobs: uses: ramsey/composer-install@v1 with: dependency-versions: ${{matrix.dependency-versions}} + composer-versions: ${{matrix.composer-options}} - name: Run php-cs-fixer if: ${{ matrix.php-cs-fixer }} @@ -132,5 +143,4 @@ jobs: run: vendor/bin/behat --suite=zend_lucene - name: Execute elastic behat tests - if: ${{ matrix.php-version < '8.0' }} # requires fixing elastic tests on 7.11 (sorting) run: vendor/bin/behat --suite=elastic diff --git a/Search/Adapter/ElasticSearchAdapter.php b/Search/Adapter/ElasticSearchAdapter.php index 19daa02e..a04d362b 100644 --- a/Search/Adapter/ElasticSearchAdapter.php +++ b/Search/Adapter/ElasticSearchAdapter.php @@ -78,6 +78,17 @@ public function __construct(Factory $factory, ElasticSearchClient $client, $vers $this->factory = $factory; $this->client = $client; $this->version = $version; + + if (\version_compare($this->version, '7.11.0', '>=')) { + $client->setConnectionParams([ + 'client' => [ + 'headers' => [ + 'Accept' => ['application/vnd.elasticsearch+json;compatible-with=7'], + 'Content-Type' => ['application/vnd.elasticsearch+json;compatible-with=7'], + ], + ], + ]); + } } public function index(Document $document, $indexName) diff --git a/composer.json b/composer.json index c988307d..ae5c3126 100644 --- a/composer.json +++ b/composer.json @@ -50,7 +50,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": {