Class IndexLifecycleManager
- Namespace
- Excalibur.Data.ElasticSearch.IndexManagement
- Assembly
- Excalibur.Data.ElasticSearch.dll
Provides functionality for managing the lifecycle of Elasticsearch indices including rollover, aging, and deletion.
public class IndexLifecycleManager : IIndexLifecycleManager
- Inheritance
-
IndexLifecycleManager
- Implements
- Inherited Members
Constructors
IndexLifecycleManager(ElasticsearchClient, ILogger<IndexLifecycleManager>)
Initializes a new instance of the IndexLifecycleManager class.
public IndexLifecycleManager(ElasticsearchClient client, ILogger<IndexLifecycleManager> logger)
Parameters
clientElasticsearchClientThe Elasticsearch client instance.
loggerILogger<IndexLifecycleManager>The logger instance.
Exceptions
- ArgumentNullException
Thrown if any parameter is null.
Methods
CreateLifecyclePolicyAsync(string, IndexLifecyclePolicy, CancellationToken)
Creates an index lifecycle policy in Elasticsearch.
public Task<bool> CreateLifecyclePolicyAsync(string policyName, IndexLifecyclePolicy policy, CancellationToken cancellationToken)
Parameters
policyNamestringThe name of the lifecycle policy.
policyIndexLifecyclePolicyThe lifecycle policy configuration.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the operation was successful.
DeleteLifecyclePolicyAsync(string, CancellationToken)
Deletes an index lifecycle policy from Elasticsearch.
public Task<bool> DeleteLifecyclePolicyAsync(string policyName, CancellationToken cancellationToken)
Parameters
policyNamestringThe name of the lifecycle policy to delete.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the operation was successful.
GetIndexLifecycleStatusAsync(string?, CancellationToken)
Gets the status of indices managed by lifecycle policies.
public Task<IEnumerable<IndexLifecycleStatus>> GetIndexLifecycleStatusAsync(string? indexPattern, CancellationToken cancellationToken)
Parameters
indexPatternstringThe index pattern to check. If null, checks all indices.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<IEnumerable<IndexLifecycleStatus>>
A Task<TResult> containing index lifecycle status information.
MoveToNextPhaseAsync(string, CancellationToken)
Forces a lifecycle policy to move to the next phase for specified indices.
public Task<bool> MoveToNextPhaseAsync(string indexPattern, CancellationToken cancellationToken)
Parameters
indexPatternstringThe pattern of indices to move to next phase.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<bool>
A Task<TResult> indicating whether the operation was successful.
RolloverIndexAsync(string, RolloverConditions, CancellationToken)
Performs index rollover based on the specified conditions.
public Task<IndexRolloverResult> RolloverIndexAsync(string aliasName, RolloverConditions rolloverConditions, CancellationToken cancellationToken)
Parameters
aliasNamestringThe alias name to rollover.
rolloverConditionsRolloverConditionsThe conditions for rollover.
cancellationTokenCancellationTokenThe cancellation token to cancel the operation if required.
Returns
- Task<IndexRolloverResult>
A Task<TResult> containing rollover results.