示例#1
0
        public static Task UnfreezePlanAsync(this ISearchIndexManager manager, string indexName, Action <UnfreezePlanSearchIndexOptions> configureOptions)
        {
            var options = new UnfreezePlanSearchIndexOptions();

            configureOptions(options);

            return(manager.UnfreezePlanAsync(indexName, options));
        }
        public async Task UnfreezePlanAsync(string indexName, UnfreezePlanSearchIndexOptions options)
        {
            var baseUri = GetFreezeControlUri(indexName, false);

            Logger.LogInformation($"Trying to unfreeze index with name {indexName} - {baseUri}");

            try
            {
                var result = await _client.PostAsync(baseUri, null, options.CancellationToken).ConfigureAwait(false);

                if (result.StatusCode == HttpStatusCode.NotFound)
                {
                    throw new SearchIndexNotFound(indexName);
                }

                result.EnsureSuccessStatusCode();
            }
            catch (Exception exception)
            {
                Logger.LogError(exception, $"Failed to unfreeze index with name {indexName} - {baseUri}");
                throw;
            }
        }