Table of Contents

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

client ElasticsearchClient

The Elasticsearch client instance.

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

policyName string

The name of the lifecycle policy.

policy IndexLifecyclePolicy

The lifecycle policy configuration.

cancellationToken CancellationToken

The 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

policyName string

The name of the lifecycle policy 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.

GetIndexLifecycleStatusAsync(string?, CancellationToken)

Gets the status of indices managed by lifecycle policies.

public Task<IEnumerable<IndexLifecycleStatus>> GetIndexLifecycleStatusAsync(string? indexPattern, CancellationToken cancellationToken)

Parameters

indexPattern string

The index pattern to check. If null, checks all indices.

cancellationToken CancellationToken

The 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

indexPattern string

The pattern of indices to move to next phase.

cancellationToken CancellationToken

The 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

aliasName string

The alias name to rollover.

rolloverConditions RolloverConditions

The conditions for rollover.

cancellationToken CancellationToken

The cancellation token to cancel the operation if required.

Returns

Task<IndexRolloverResult>

A Task<TResult> containing rollover results.