/// <summary>
        /// Creates a new instance of the SearchIndexingBufferedSender.
        /// </summary>
        /// <param name="searchClient">
        /// The SearchClient used to send requests to the service.
        /// </param>
        /// <param name="options">
        /// Provides the configuration options for the sender.
        /// </param>
        internal SearchIndexingBufferedSender(
            SearchClient searchClient,
            SearchIndexingBufferedSenderOptions <T> options = null)
        {
            Argument.AssertNotNull(searchClient, nameof(searchClient));
            SearchClient = searchClient;

            options ??= new SearchIndexingBufferedSenderOptions <T>();
            KeyFieldAccessor = options.KeyFieldAccessor;
            _publisher       = new SearchIndexingPublisher <T>(
                this,
                options.AutoFlush,
                options.AutoFlushInterval,
                options.BatchActionSize,
                options.BatchPayloadSize,
                options.RetryCount,
                options.FlushCancellationToken);
        }
        /// <summary>
        /// Creates a new instance of <see cref="SearchIndexingBufferedSender{T}"/> that
        /// can be used to index search documents with intelligent batching,
        /// automatic flushing, and retries for failed indexing actions.
        /// </summary>
        /// <param name="searchClient">
        /// The SearchClient used to send requests to the service.
        /// </param>
        /// <param name="options">
        /// The <see cref="SearchIndexingBufferedSenderOptions{T}"/> to
        /// customize the sender's behavior.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// Thrown when the <paramref name="searchClient"/> is null.
        /// </exception>
        public SearchIndexingBufferedSender(
            SearchClient searchClient,
            SearchIndexingBufferedSenderOptions <T> options = null)
        {
            Argument.AssertNotNull(searchClient, nameof(searchClient));
            SearchClient = searchClient;

            options ??= new SearchIndexingBufferedSenderOptions <T>();
            KeyFieldAccessor = options.KeyFieldAccessor;
            _publisher       = new SearchIndexingPublisher <T>(
                this,
                options.AutoFlush,
                options.AutoFlushInterval,
                options.InitialBatchActionCount,
                options.BatchPayloadSize,
                options.MaxRetriesPerIndexAction,
                options.ThrottlingDelay,
                options.MaxThrottlingDelay,
                options.FlushCancellationToken);
        }