From 2688e4bc110c3d691b5ad9983ef1dd437e63bd53 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 21 Apr 2022 03:47:11 +0200 Subject: [PATCH 1/3] Try rest api compatibility layer --- Service/ManagerFactory.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Service/ManagerFactory.php b/Service/ManagerFactory.php index 0cb81d41..89c491f3 100644 --- a/Service/ManagerFactory.php +++ b/Service/ManagerFactory.php @@ -136,6 +136,15 @@ public function createManager($managerName, $connection, $analysis, $managerConf if (version_compare($elasticSearchVersion, '7.0.0', '>=')) { $indexSettings['include_type_name'] = true; + + $client->setConnectionParams([ + 'client' => [ + 'headers' => [ + 'Accept' => ['application/vnd.elasticsearch+json;compatible-with=7'], + 'Content-Type' => ['application/vnd.elasticsearch+json;compatible-with=7'], + ] + ] + ]); } $this->eventDispatcher && From f3d5a651f73681add11f431a35696ef968c19b57 Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 21 Apr 2022 04:16:55 +0200 Subject: [PATCH 2/3] Add bc layer --- Result/Converter.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Result/Converter.php b/Result/Converter.php index 096e29cb..db8e6252 100644 --- a/Result/Converter.php +++ b/Result/Converter.php @@ -53,6 +53,8 @@ public function convertToDocument($rawData, Manager $manager) if (isset($types[$rawData['_type']])) { $metadata = $types[$rawData['_type']]; + } elseif ($rawData['_type'] === '_doc') { + $metadata = reset($types); } else { throw new \LogicException("Got document of unknown type '{$rawData['_type']}'."); } From 1f3c75a8b03b3bce31f80144e20c536204d0f12f Mon Sep 17 00:00:00 2001 From: Alexander Schranz Date: Thu, 21 Apr 2022 04:18:23 +0200 Subject: [PATCH 3/3] Fix content and accept type problems --- Service/ManagerFactory.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Service/ManagerFactory.php b/Service/ManagerFactory.php index 89c491f3..4d0bcd73 100644 --- a/Service/ManagerFactory.php +++ b/Service/ManagerFactory.php @@ -137,14 +137,16 @@ public function createManager($managerName, $connection, $analysis, $managerConf if (version_compare($elasticSearchVersion, '7.0.0', '>=')) { $indexSettings['include_type_name'] = true; - $client->setConnectionParams([ - 'client' => [ - 'headers' => [ - 'Accept' => ['application/vnd.elasticsearch+json;compatible-with=7'], - 'Content-Type' => ['application/vnd.elasticsearch+json;compatible-with=7'], + if (version_compare($elasticSearchVersion, '7.11.0', '>=')) { + $client->setConnectionParams([ + 'client' => [ + 'headers' => [ + 'Accept' => ['application/vnd.elasticsearch+json;compatible-with=7'], + 'Content-Type' => ['application/vnd.elasticsearch+json;compatible-with=7'], + ] ] - ] - ]); + ]); + } } $this->eventDispatcher &&