PHP code example of elastic / elasticsearch-serverless
1. Go to this page and download the library: Download elastic/elasticsearch-serverless library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
elastic / elasticsearch-serverless example snippets
use Elastic\Elasticsearch\Serverless\ClientBuilder;
$client = ClientBuilder::create()
->setEndpoint('<elasticsearch-endpoint>')
->setApiKey('<api-key>')
->build();
# $client is an object of Elastic\Elasticsearch\Serverless\Client class