Table of Contents

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

client ElasticsearchClient

The Elasticsearch client instance.

logger ILogger<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

templateName string
template ComponentTemplateConfiguration
cancellationToken CancellationToken

Returns

Task<bool>

CreateOrUpdateTemplateAsync(string, IndexTemplateConfiguration, CancellationToken)

Creates or updates an index template in Elasticsearch.

public Task<bool> CreateOrUpdateTemplateAsync(string templateName, IndexTemplateConfiguration template, CancellationToken cancellationToken)

Parameters

templateName string

The name of the index template.

template IndexTemplateConfiguration

The template configuration.

cancellationToken CancellationToken

The 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

templateName string
cancellationToken CancellationToken

Returns

Task<bool>

DeleteTemplateAsync(string, CancellationToken)

Deletes an index template from Elasticsearch.

public Task<bool> DeleteTemplateAsync(string templateName, CancellationToken cancellationToken)

Parameters

templateName string

The name of the index template to delete.

cancellationToken CancellationToken

The 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

namePattern string

The pattern to match template names against. If null, returns all templates.

cancellationToken CancellationToken

The 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

templateName string
newTemplate IndexTemplateConfiguration
migrationOptions TemplateMigrationOptions
cancellationToken CancellationToken

Returns

Task<TemplateMigrationResult>

TemplateExistsAsync(string, CancellationToken)

Checks if an index template exists in Elasticsearch.

public Task<bool> TemplateExistsAsync(string templateName, CancellationToken cancellationToken)

Parameters

templateName string

The name of the index template to check.

cancellationToken CancellationToken

The 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

template IndexTemplateConfiguration

The template configuration to validate.

cancellationToken CancellationToken

The cancellation token to cancel the operation if required.

Returns

Task<TemplateValidationResult>

A Task<TResult> containing validation results.