Class IndexTemplateManager
- Namespace
- Excalibur.Data.ElasticSearch.IndexManagement
- Assembly
- Excalibur.Data.ElasticSearch.dll
Provides functionality for managing Elasticsearch index templates including creation, updates, and validation.
public sealed class IndexTemplateManager : IIndexTemplateManager
- Inheritance
-
IndexTemplateManager
- Implements
- Inherited Members
- Extension Methods
Constructors
IndexTemplateManager(ElasticsearchClient, ILogger<IndexTemplateManager>)
Initializes a new instance of the IndexTemplateManager class.
public IndexTemplateManager(ElasticsearchClient client, ILogger<IndexTemplateManager> logger)
Parameters
clientElasticsearchClientThe Elasticsearch client instance.
loggerILogger<IndexTemplateManager>The logger instance.
Exceptions
- ArgumentNullException
Thrown if any parameter is null.
Methods
CreateOrUpdateComponentTemplateAsync(string, ComponentTemplateConfiguration, CancellationToken)
public Task<bool> CreateOrUpdateComponentTemplateAsync(string templateName, ComponentTemplateConfiguration template, CancellationToken cancellationToken)
Parameters
templateNamestringtemplateComponentTemplateConfigurationcancellationTokenCancellationToken
Returns
CreateOrUpdateTemplateAsync(string, IndexTemplateConfiguration, CancellationToken)
Creates or updates an index template in Elasticsearch.
public Task<bool> CreateOrUpdateTemplateAsync(string templateName, IndexTemplateConfiguration template, CancellationToken cancellationToken)
Parameters
templateNamestringThe name of the index template.
templateIndexTemplateConfigurationThe template configuration.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the operation was successful.
DeleteComponentTemplateAsync(string, CancellationToken)
public Task<bool> DeleteComponentTemplateAsync(string templateName, CancellationToken cancellationToken)
Parameters
templateNamestringcancellationTokenCancellationToken
Returns
DeleteTemplateAsync(string, CancellationToken)
Deletes an index template from Elasticsearch.
public Task<bool> DeleteTemplateAsync(string templateName, CancellationToken cancellationToken)
Parameters
templateNamestringThe name of the index template to delete.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the operation was successful.
GetTemplatesAsync(string?, CancellationToken)
Gets all index templates that match the specified pattern.
public Task<IEnumerable<IndexTemplateDescriptor>> GetTemplatesAsync(string? namePattern, CancellationToken cancellationToken)
Parameters
namePatternstringThe pattern to match template names against. If null, returns all templates.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<IEnumerable<IndexTemplateDescriptor>>
A Task<TResult> containing the matching templates.
MigrateTemplateAsync(string, IndexTemplateConfiguration, TemplateMigrationOptions, CancellationToken)
public Task<TemplateMigrationResult> MigrateTemplateAsync(string templateName, IndexTemplateConfiguration newTemplate, TemplateMigrationOptions migrationOptions, CancellationToken cancellationToken)
Parameters
templateNamestringnewTemplateIndexTemplateConfigurationmigrationOptionsTemplateMigrationOptionscancellationTokenCancellationToken
Returns
TemplateExistsAsync(string, CancellationToken)
Checks if an index template exists in Elasticsearch.
public Task<bool> TemplateExistsAsync(string templateName, CancellationToken cancellationToken)
Parameters
templateNamestringThe name of the index template to check.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the template exists.
ValidateTemplateAsync(IndexTemplateConfiguration, CancellationToken)
Validates an index template configuration without applying it.
public Task<TemplateValidationResult> ValidateTemplateAsync(IndexTemplateConfiguration template, CancellationToken cancellationToken)
Parameters
templateIndexTemplateConfigurationThe template configuration to validate.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<TemplateValidationResult>
A Task<TResult> containing validation results.