Пример #1
0
        public static async Task RecreateIndexAsync(this IIndex index, CancellationToken cancellationToken)
        {
            // Validate parameters.
            if (index == null)
            {
                throw new ArgumentNullException(nameof(index));
            }

            // Destroy the index if it exists.
            if (await index.ExistsAsync(cancellationToken).ConfigureAwait(false))
            {
                // Destroy it.
                await index.DestroyAsync(cancellationToken).ConfigureAwait(false);
            }

            // Create the index.
            await index.CreateAsync(cancellationToken).ConfigureAwait(false);
        }