Skip to content

Commit

Permalink
Merge pull request #28 from handcraftedinthealps/feature/elasticsearc…
Browse files Browse the repository at this point in the history
…h-7-8-layer

Add rest api compatibility layer
  • Loading branch information
Prokyonn authored Aug 16, 2022
2 parents 23b14de + 1f3c75a commit 9e0702a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Result/Converter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']}'.");
}
Expand Down
11 changes: 11 additions & 0 deletions Service/ManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,17 @@ public function createManager($managerName, $connection, $analysis, $managerConf

if (version_compare($elasticSearchVersion, '7.0.0', '>=')) {
$indexSettings['include_type_name'] = true;

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 &&
Expand Down

0 comments on commit 9e0702a

Please sign in to comment.