Table of Contents

Class IndexOperationsManager

Namespace
Excalibur.Data.ElasticSearch.IndexManagement
Assembly
Excalibur.Data.ElasticSearch.dll

Provides functionality for dynamic index operations including creation, optimization, and health monitoring.

public sealed class IndexOperationsManager : IIndexOperationsManager
Inheritance
IndexOperationsManager
Implements
Inherited Members
Extension Methods

Remarks

Initializes a new instance of the IndexOperationsManager class.

Constructors

IndexOperationsManager(ElasticsearchClient, ILogger<IndexOperationsManager>)

Provides functionality for dynamic index operations including creation, optimization, and health monitoring.

public IndexOperationsManager(ElasticsearchClient client, ILogger<IndexOperationsManager> logger)

Parameters

client ElasticsearchClient

The Elasticsearch client instance.

logger ILogger<IndexOperationsManager>

The logger instance.

Remarks

Initializes a new instance of the IndexOperationsManager class.

Exceptions

ArgumentNullException

Thrown if any parameter is null.

Methods

CreateIndexAsync(string, IndexConfiguration, CancellationToken)

Creates an index with the specified configuration.

public Task<bool> CreateIndexAsync(string indexName, IndexConfiguration configuration, CancellationToken cancellationToken)

Parameters

indexName string

The name of the index to create.

configuration IndexConfiguration

The index configuration settings.

cancellationToken CancellationToken

The cancellation token to cancel the operation if required.

Returns

Task<bool>

A Task<TResult> indicating whether the operation was successful.

Exceptions

ArgumentNullException

Thrown if any parameter is null.

DeleteIndexAsync(string, CancellationToken)

Deletes an index from Elasticsearch.

public Task<bool> DeleteIndexAsync(string indexName, CancellationToken cancellationToken)

Parameters

indexName string

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

Exceptions

ArgumentNullException

Thrown if any parameter is null.

ForceMergeAsync(string, int?, CancellationToken)

public Task<bool> ForceMergeAsync(string indexName, int? maxNumSegments, CancellationToken cancellationToken)

Parameters

indexName string
maxNumSegments int?
cancellationToken CancellationToken

Returns

Task<bool>

Exceptions

ArgumentNullException

Thrown if any parameter is null.

GetIndexHealthAsync(string?, CancellationToken)

Gets health information for the specified indices.

public Task<IEnumerable<IndexHealthStatus>> GetIndexHealthAsync(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<IndexHealthStatus>>

A Task<TResult> containing index health information.

Exceptions

ArgumentNullException

Thrown if any parameter is null.

IndexExistsAsync(string, CancellationToken)

Checks if an index exists in Elasticsearch.

public Task<bool> IndexExistsAsync(string indexName, CancellationToken cancellationToken)

Parameters

indexName string

The name of the index to check.

cancellationToken CancellationToken

The cancellation token to cancel the operation if required.

Returns

Task<bool>

A Task<TResult> indicating whether the index exists.

Exceptions

ArgumentNullException

Thrown if any parameter is null.

OptimizeIndexAsync(string, IndexOptimizationOptions, CancellationToken)

public Task<IndexOptimizationResult> OptimizeIndexAsync(string indexName, IndexOptimizationOptions optimizationOptions, CancellationToken cancellationToken)

Parameters

indexName string
optimizationOptions IndexOptimizationOptions
cancellationToken CancellationToken

Returns

Task<IndexOptimizationResult>

Exceptions

ArgumentNullException

Thrown if any parameter is null.

UpdateIndexSettingsAsync(string, JsonElement, CancellationToken)

Updates index settings dynamically.

public Task<bool> UpdateIndexSettingsAsync(string indexName, JsonElement settingsJson, CancellationToken cancellationToken)

Parameters

indexName string

The name of the index to update.

settingsJson JsonElement

The new settings to apply as opaque JSON.

cancellationToken CancellationToken

The cancellation token to cancel the operation if required.

Returns

Task<bool>

A Task<TResult> indicating whether the operation was successful.

Exceptions

ArgumentNullException

Thrown if any parameter is null.