forked from opensearch-project/opensearch-php
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
33 lines (24 loc) · 752 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
use OpenSearch\GuzzleClientFactory;
use OpenSearch\SymfonyClientFactory;
/**
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
require_once __DIR__ . '/vendor/autoload.php';
// Guzzle example
$client = (new GuzzleClientFactory())->create([
'base_uri' => 'https://localhost:9200',
'auth' => ['admin', getenv('OPENSEARCH_PASSWORD')],
'verify' => false,
]);
// Send a request to the 'info' endpoint.
$info = $client->info();
// Symfony example
$client = (new SymfonyClientFactory())->create([
'base_uri' => 'https://localhost:9200',
'auth_basic' => ['admin', getenv('OPENSEARCH_PASSWORD')],
'verify_peer' => false,
]);
// Send a request to the 'info' endpoint.
$info = $client->info();