CoolCMS API

EsConfig
in package

FinalYes

Configuration of the Elasticsearch integration.

Filled from config/Shared/elasticsearch.neon; hosts and credentials are overridden in the git-ignored Shared/local.neon.

Table of Contents

Constants

DEFAULT_HOST  : string = 'http://127.0.0.1:9200'

Properties

$enabled  : bool
$enabledSources  : array<string|int, mixed>
$hosts  : array<string|int, string>
$indexPrefix  : string
$password  : string|null
$username  : string|null

Methods

__construct()  : mixed
getHosts()  : array<string|int, string>
getIndexName()  : string
Returns the read alias of the index; search goes here.
getIndexPrefix()  : string
getPassword()  : string|null
getRedisKey()  : string
Returns the Redis key of the integration (circuit breaker, locks, watermarks, monitoring), namespaced by `indexPrefix`.
getUsername()  : string|null
getWriteIndexName()  : string
Returns the write alias; indexing goes here and a full reindex points it to the new version.
isEnabled()  : bool
isSourceEnabled()  : bool

Constants

DEFAULT_HOST

public string DEFAULT_HOST = 'http://127.0.0.1:9200'

Properties

$enabled read-only

private bool $enabled = false

$enabledSources read-only

private array<string|int, mixed> $enabledSources = []

$hosts read-only

private array<string|int, string> $hosts

$indexPrefix read-only

private string $indexPrefix = 'cms'

$password read-only

private string|null $password = null

$username read-only

private string|null $username = null

Methods

__construct()

public __construct([bool $enabled = false ][, array<string|int, string> $hosts = [self::DEFAULT_HOST] ][, string|null $username = null ][, string|null $password = null ][, string $indexPrefix = 'cms' ][, array<string|int, string> $enabledSources = [] ]) : mixed
Parameters
$enabled : bool = false
$hosts : array<string|int, string> = [self::DEFAULT_HOST]
$username : string|null = null
$password : string|null = null
$indexPrefix : string = 'cms'
$enabledSources : array<string|int, string> = []

per-source rollout allowlist (DocumentSourceInterface keys, e.g. blog_article), allows ES to be on for Blog while Bazaar still uses MySQL

getHosts()

public getHosts() : array<string|int, string>
Return values
array<string|int, string>

getIndexName()

Returns the read alias of the index; search goes here.

public getIndexName(string $indexBase) : string
Parameters
$indexBase : string
Return values
string

getIndexPrefix()

public getIndexPrefix() : string
Return values
string

getPassword()

public getPassword() : string|null
Return values
string|null

getRedisKey()

Returns the Redis key of the integration (circuit breaker, locks, watermarks, monitoring), namespaced by `indexPrefix`.

public getRedisKey(string $suffix) : string

Without the prefix two environments sharing one Redis would share es:down and the sync watermark: an outage of one would switch search off for the other, and a sync of one would move the watermark of the other (silent loss of changes until the nightly reindex).

Parameters
$suffix : string
Return values
string

getUsername()

public getUsername() : string|null
Return values
string|null

getWriteIndexName()

Returns the write alias; indexing goes here and a full reindex points it to the new version.

public getWriteIndexName(string $indexBase) : string
Parameters
$indexBase : string
Return values
string

isEnabled()

public isEnabled() : bool
Return values
bool

isSourceEnabled()

public isSourceEnabled(string $sourceKey) : bool
Parameters
$sourceKey : string
Return values
bool
On this page

Search results