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
clientElasticsearchClientThe Elasticsearch client instance.
loggerILogger<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
indexNamestringThe name of the index to create.
configurationIndexConfigurationThe index configuration settings.
cancellationTokenCancellationTokenThe 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
indexNamestringThe name of the index to delete.
cancellationTokenCancellationTokenThe 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
indexNamestringmaxNumSegmentsint?cancellationTokenCancellationToken
Returns
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
indexPatternstringThe index pattern to check. If null, checks all indices.
cancellationTokenCancellationTokenThe 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
indexNamestringThe name of the index to check.
cancellationTokenCancellationTokenThe 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
indexNamestringoptimizationOptionsIndexOptimizationOptionscancellationTokenCancellationToken
Returns
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
indexNamestringThe name of the index to update.
settingsJsonJsonElementThe new settings to apply as opaque JSON.
cancellationTokenCancellationTokenThe 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.