Skip to content

Commit

Permalink
Fix sample
Browse files Browse the repository at this point in the history
Signed-off-by: Kim Pepper <kim@pepper.id.au>
  • Loading branch information
kimpepper committed Oct 23, 2024
1 parent f14e9a2 commit 28d80b2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions samples/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@

$client = (new \OpenSearch\ClientBuilder($transport))->build();

$client = new OpenSearch\Client($transport, $requestFactory, $httpFactory);
$info = $client->info();

echo "{$info['version']['distribution']}: {$info['version']['number']}\n";

// Symfony example

$symfonyClient = \Symfony\Component\HttpClient\HttpClient::create([
$symfonyPsr18Client = (new \Symfony\Component\HttpClient\Psr18Client())->withOptions([
'base_uri' => 'https://localhost:9200',
'auth_basic' => ['admin', getenv('OPENSEARCH_PASSWORD')],
'verify_peer' => false,
Expand All @@ -45,7 +43,8 @@
],
]);

$client = new OpenSearch\Client($symfonyClient);
$info = $client->info();
$transport = new OpenSearch\Transport($symfonyPsr18Client, $requestFactory);

$client = (new \OpenSearch\ClientBuilder($transport))->build();

echo "{$info['version']['distribution']}: {$info['version']['number']}\n";
$info = $client->info();

0 comments on commit 28d80b2

Please sign in to comment.