Skip to content
This repository was archived by the owner on Apr 10, 2025. It is now read-only.

Official PHP client for Elasticsearch Serverless

License

Notifications You must be signed in to change notification settings

elastic/elasticsearch-serverless-php

Repository files navigation

Elasticsearch Serverless Client

main

Warning

Starting with the release of the Elastic Stack 9.0.0, this client will be discontinued. Instead, you can use the latest version of the Elasticsearch PHP Client to build your Elasticsearch Serverless PHP applications.

This is the official Elastic client for the Elasticsearch Cloud Serverless.

If you're looking to develop your PHP application with the Elasticsearch Stack, you should look at the Elasticsearch Client instead.

Installation

You can install the library using composer with the following command:

composer require elastic/elasticsearch-serverless

Instantiate the client

When you have installed elasticsearch-php you can start using it with the Client class. You can use the ClientBuilder to create this object:

require 'vendor/autoload.php';

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

Usage

You can read to the official documentation page for a getting started guide.

Development

See CONTRIBUTING.

License 📗

MIT © Elastic