Skip to content

Commit c5e538d

Browse files
committed
MC-31098: Add support of Elasticsearch7 to codebase
1 parent df3fe14 commit c5e538d

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

app/code/Magento/Elasticsearch7/Model/Client/Elasticsearch.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ public function __construct(
4949
__('The search failed because of a search engine misconfiguration.')
5050
);
5151
}
52-
53-
$this->client[getmypid()] = $elasticsearchClient;
52+
// phpstan:ignore
53+
if ($elasticsearchClient instanceof \Elasticsearch\Client) {
54+
$this->client[getmypid()] = $elasticsearchClient;
55+
}
5456
$this->clientOptions = $options;
5557
}
5658

@@ -73,7 +75,7 @@ public function suggest(array $query) : array
7375
private function getElasticsearchClient(): \Elasticsearch\Client
7476
{
7577
$pid = getmypid();
76-
if (!isset($this->client[$pid]) || !($this->client[$pid] instanceof \Elasticsearch\Client)) {
78+
if (!isset($this->client[$pid])) {
7779
$config = $this->buildESConfig($this->clientOptions);
7880
$this->client[$pid] = \Elasticsearch\ClientBuilder::fromConfig($config, true);
7981
}

app/code/Magento/Elasticsearch7/Test/Unit/Model/Client/ElasticsearchTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ public function testQuery()
605605
*/
606606
public function testSuggest()
607607
{
608-
$query = 'query';
608+
$query = ['query'];
609609
$this->elasticsearchClientMock->expects($this->once())
610610
->method('suggest')
611611
->willReturn([]);

app/code/Magento/Indexer/Console/Command/IndexerReindexCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9898
$output->writeln($e->getMessage());
9999
} catch (\Exception $e) {
100100
$output->writeln($indexer->getTitle() . ' indexer process unknown error:');
101-
$output->writeln([$e->getMessage()]);
101+
$output->writeln($e->getMessage());
102102
}
103103
}
104104
return $returnValue;

composer.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)