public static Task DropIndexAsync(this ISearchIndexManager manager, string indexName, Action <DropSearchIndexOptions> configureOptions) { var options = new DropSearchIndexOptions(); configureOptions(options); return(manager.DropIndexAsync(indexName, options)); }
public async Task DropIndexAsync(string indexName, DropSearchIndexOptions options) { var baseUri = GetIndexUri(indexName); Logger.LogInformation($"Trying to drop index with name {indexName} - {baseUri}"); try { var result = await _client.DeleteAsync(baseUri, options.CancellationToken).ConfigureAwait(false); if (result.StatusCode == HttpStatusCode.NotFound) { throw new SearchIndexNotFound(indexName); } result.EnsureSuccessStatusCode(); } catch (Exception exception) { Logger.LogError(exception, $"Failed to drop index with name {indexName} - {baseUri}"); throw; } }