ElasticSearchAdapter
class ElasticSearchAdapter implements SearchAdapterInterface
Elastic Search Adapter Uses an Elastic Search Server for indexing and search operations in XELOS
Traits
Constants
| protected ELASTIC_TYPE_NAME |
ES7+ does only have a single type per index and is using _doc as dummy type |
Properties
| SearchController | $mod | ||
| protected Client|null | $elastic_client | ElasticSearch Client - is initialized on first getElasticSearchClient() call |
|
| protected string | $recommendedESVersion | What is the expected/recommended elasticsearch version for this code? |
|
| protected string | $elastic_index_name | ElasticSearch Index Name |
|
| protected string|null | $elastic_alias_name | We will use the alias name as primary method to read, write to the index Default is {$elastic_index_name}-alias = xelos-alias |
|
| protected string | $elastic_index_version | Increase this manually if changes to the index were made which required re-indexing Please note that not all operations can be done with a local reindex and may require an XELOS reindex process. You should cover this in MAJOR releases and with a proper install event. |
|
| protected int | $elastic_shard_count | When using a single instance, using 1 shard will save memory When using a cluster, you should have at least 3 shards otherwise they cannot be balanced ES Defaults (v6=5, v7=1) |
|
| protected int | $elastic_replica_count | When using a single instance, no replica will be started, even with replica=1 (Status will stay yellow) When using a cluster, you should use at least 1 replica - but we can also use 2 replica for more read performance ES Default: 1 |
|
| protected int | $elastic_tentant_id | Ability to use a shared elastic index |
|
| protected bool | $aliasAccessOnly | When we have limited access - we may need to reduce some requests or they will fail and throw errors |
Methods
No description
https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html
Mass Update to update a few search index attributes for many documents at once This command will not create new Index entries but only update existing ones
No description
Remove old Monitoring Indices todo: Might NOT be a good idea if ES is a shared instance.. , add config option and trigger in maintenance cron
Create index if it does not exist and creation is possible
Code is only here for documentation purposes / Work in Progress Requirement: add path.repo in config (e.g. path.repo=/usr/share/elasticsearch/data/backup )
No description
User will get access to the alias pointing to their index
No description
Get Elastic Index Name with Version suffix
Returns all found file extensions of all attachments of SearchIndexRecord.
Returns the fulltext content of all attachments of SearchIndexRecord.
Returns a combined hash string of all file contents of the attachments of SearchIndexRecord.
Returns a document index collection of search results without rights, instance access or group security checks.
Returns a connected Elastic Search Client Object
No description
No description
Returns true if the index schema is uptodate, false if not.
Get Index Settings
No description
Get list of snapshots taken
Get unsupported elastic search version
Get Elastic Index Name with Version suffix This should be used when trying to create or delete index, use getAliasName for Search and Queries
Can we use xPackSecurity Features?
Restore a Snapshot, this function is not
No description
Used during Module Transition to allow a partial move to new Adapter Design
Details
at line 121
__construct()
No description
at line 792
protected string|null
_reindex(string $oldIndex, string $newIndex, bool $waitForCompletion = false)
at line 150
addToIndex(SearchIndexRecord $searchIndexRecord)
No description
at line 1443
void
bulkUpdateDocumentsByCallback(array $documentIds, callable $callback, string[] $requiredFields = ['_id', 'meta_data'])
Mass Update to update a few search index attributes for many documents at once This command will not create new Index entries but only update existing ones
at line 505
cleanIndex()
No description
at line 1330
protected
cleanupOldIndicesAndSnapshots()
Remove old Monitoring Indices todo: Might NOT be a good idea if ES is a shared instance.. , add config option and trigger in maintenance cron
at line 695
protected bool
createIndexIfNotExists()
Create index if it does not exist and creation is possible
at line 1241
bool
createSnapshot()
Code is only here for documentation purposes / Work in Progress Requirement: add path.repo in config (e.g. path.repo=/usr/share/elasticsearch/data/backup )
at line 1345
protected
createUpdateFilteredAlias(string $indexName = null, string $aliasName = null)
No description
at line 1377
protected bool
createUserAndRoleForAlias(string $user, string $password = null)
User will get access to the alias pointing to their index
at line 1417
protected
deleteUserAndRole($user)
No description
at line 829
string
getAliasName()
Get Elastic Index Name with Version suffix
in
AttachmentTrait at line 47
protected array
getAttachmentFileExtensions(SearchIndexRecord $searchIndexRecord)
Returns all found file extensions of all attachments of SearchIndexRecord.
Returns empty array if there are no attachments.
in
AttachmentTrait at line 18
protected string
getAttachmentFulltextContent(SearchIndexRecord $searchIndexRecord)
Returns the fulltext content of all attachments of SearchIndexRecord.
Returns empty string if there are no attachments.
in
AttachmentTrait at line 73
protected string
getAttachmentsHash(SearchIndexRecord $searchIndexRecord)
Returns a combined hash string of all file contents of the attachments of SearchIndexRecord.
Returns empty string if there are no attachments.
at line 1542
DocumentIndexCollection
getDocumentIndexCollectionFromIndex(string $searchTerm, int $updatedSinceTimestamp = 0, string $pointInTimeReference = null, int $searchAfterReference = null, int $hitCount = null, bool $withSearchIndexInformation = false)
Returns a document index collection of search results without rights, instance access or group security checks.
at line 525
Client
getElasticSearchClient()
Returns a connected Elastic Search Client Object
at line 278
array
getFromIndex(DocumentIndex $DocumentIndex)
No description
at line 836
bool
getHasRestrictedAccess()
No description
at line 317
array
getIndexInfo()
No description
at line 846
array
getIndexSchemaStatus()
Returns true if the index schema is uptodate, false if not.
at line 964
array
getIndexSetting()
Get Index Settings
at line 1150
UIComponent|null
getMaintenanceUI()
No description
at line 1118
array[]
getSearchUpdateDSL(SearchUpdateRecord $searchUpdateRecord)
No description
at line 1282
array
getSnapshots()
Get list of snapshots taken
at line 544
string
getUnsupportedElasticSearchVersion()
Get unsupported elastic search version
at line 820
protected string
getVersionedIndexName()
Get Elastic Index Name with Version suffix This should be used when trying to create or delete index, use getAliasName for Search and Queries
at line 686
protected bool
isSecurityPackAvailable()
Can we use xPackSecurity Features?
at line 239
removeFromIndex(DocumentIndex $DocumentIndex)
No description
at line 1303
restoreSnapshot($nameOfSnapshotToRestore)
Restore a Snapshot, this function is not
at line 296
search(array $query, array $options = [])
No description
at line 310
setMod(SearchController $mod)
Used during Module Transition to allow a partial move to new Adapter Design