New

The executive guide to generative AI

Read more
IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Enterprise Search API

edit

Health API

edit

The documentation of the Health API is reported here.

use Elastic\EnterpriseSearch\Client;
use Elastic\EnterpriseSearch\EnterpriseSearch\Request;
use Elastic\EnterpriseSearch\EnterpriseSearch\Schema;

$client = new Client([
    'host' => 'http://localhost:3002',
    'enterprise-search' => [
        'username' => '<insert here the username>',
        'password' => '<insert here the password>'
    ]
]);

$enterpriseSearch = $client->enterpriseSearch();
$response = $enterpriseSearch->getHealth(new Request\GetHealth);
print_r($response->asArray());

Version API

edit
$result = $enterpriseSearch->getVersion(new Request\GetVersion);
print_r($response->asArray());

Managing Read-Only mode:

edit

The documentation of the Read-Only mode API is reported here.

// Set read-only flag state
$enterpriseSearch->putReadOnly(
    new Request\PutReadOnly(
        new ReadOnlyState(true)
    )
);

// Get read-only flag state
$result = $enterpriseSearch->getReadOnly(new Request\GetReadOnly);
var_dump($result['enabled']);

Stats API

edit

The documentation of the Stats API is reported here.

$response = $enterpriseSearch->getStats(new Request\GetStats);
print_r($response->asArray());
Was this helpful?
Feedback