import type { BulkOperation, BulkBatchResult, BulkIndexerConfig, BulkIndexerStats, BackpressureState } from './types.js'; /** * Enterprise-grade bulk indexer with adaptive batching and parallel workers * * Features: * - Adaptive batching based on document size and performance * - Parallel workers for maximum throughput * - Automatic retries with exponential backoff * - Dead-letter queue for permanently failed operations * - Backpressure handling to prevent memory issues * - Progress callbacks and statistics * - Stream support via async iteration * - Full observability integration * * @example * ```typescript * const indexer = new BulkIndexer({ * batchingStrategy: 'adaptive', * maxBatchSize: 1000, * workers: 4, * enableDeadLetterQueue: true, * onProgress: (progress) => { * console.log(`Processed: ${progress.totalProcessed}/${progress.totalSubmitted}`); * } * }); * * await indexer.start(); * * // Submit operations * for (const doc of documents) { * await indexer.index('my-index', doc.id, doc); * } * * await indexer.flush(); * await indexer.stop(); * ``` */ export declare class BulkIndexer { private config; private queue; private workers; private stats; private running; private flushTimer?; private lastProgressReport; private operationTimestamps; private batchSizes; private batchDurations; private deadLetterQueue; constructor(config?: BulkIndexerConfig); /** * Create a new bulk indexer */ static create(config?: BulkIndexerConfig): BulkIndexer; /** * Start the bulk indexer */ start(): Promise; /** * Stop the bulk indexer */ stop(): Promise; /** * Index a document */ index(index: string, id: string | undefined, document: T): Promise; /** * Create a document (fails if exists) */ create(index: string, id: string, document: T): Promise; /** * Update a document */ update(index: string, id: string, partialDocument: Partial, options?: { retryOnConflict?: number; }): Promise; /** * Delete a document */ delete(index: string, id: string): Promise; /** * Submit a custom bulk operation */ submit(operation: BulkOperation): Promise; /** * Flush pending operations immediately */ flush(): Promise; /** * Get current statistics */ getStats(): BulkIndexerStats; /** * Get backpressure state */ getBackpressure(): BackpressureState; private executeBatch; private handleFailedOperation; private sendToDeadLetterQueue; private resolveDeadLetterIndexName; private getCurrentBatchSize; private triggerFlush; private waitForBackpressure; private updateCurrentOpsPerSecond; private reportProgress; } /** * Create a new bulk indexer */ export declare function createBulkIndexer(config?: BulkIndexerConfig): BulkIndexer;