This is an automated email from the ASF dual-hosted git repository. github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/dev/pr-13557-0a341365911ab4fbc839c1a29d35e324babaee27 in repository https://gitbox.apache.org/repos/asf/seatunnel.git
commit f9b45ba7451325b8157f0ac2d614af2114b4fc93 Author: Daniel <[email protected]> AuthorDate: Mon Nov 30 14:55:21 2026 +0000 [Docs][Connector-V2] Explain Elasticsearch bulk sizing for batch imports (#13557) --- docs/en/connectors/sink/Elasticsearch.md | 18 +++++++++++++++++- docs/zh/connectors/sink/Elasticsearch.md | 18 +++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/docs/en/connectors/sink/Elasticsearch.md b/docs/en/connectors/sink/Elasticsearch.md index 2d8c1ac33b..7dd3e20b5b 100644 --- a/docs/en/connectors/sink/Elasticsearch.md +++ b/docs/en/connectors/sink/Elasticsearch.md @@ -184,7 +184,23 @@ one bulk request max try size ### max_batch_size [int] -batch bulk doc max size +The maximum number of documents buffered by each sink writer before sending a Bulk API request. The default is `10`. This limit counts documents, not bytes. + +For batch imports, set this option explicitly and benchmark increasing batch sizes with representative data. Keep parallelism and index settings fixed when comparing results. For example: + +```hocon +sink { + Elasticsearch { + hosts = ["http://localhost:9200"] + index = "batch-import" + max_batch_size = 1000 + } +} +``` + +`1000` is a starting point for measurement, not a universally optimal size. Larger batches reduce per-request overhead but increase buffered memory and the time low-volume input waits for a full batch. Account for document size and concurrent table writers; a document-count limit does not bound the HTTP payload size. See Elasticsearch's [indexing-speed guidance](https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed) for bulk sizing. + +Batch jobs flush pending documents at completion. For low-volume streaming jobs on Zeta, see [Timer flush on Zeta](#timer-flush-on-zeta) to configure `sink.flush.interval` independently of the batch-size threshold. ### tls_verify_certificate [boolean] diff --git a/docs/zh/connectors/sink/Elasticsearch.md b/docs/zh/connectors/sink/Elasticsearch.md index 019b4cce2c..1a95962e6b 100644 --- a/docs/zh/connectors/sink/Elasticsearch.md +++ b/docs/zh/connectors/sink/Elasticsearch.md @@ -176,7 +176,23 @@ sink { ### max_batch_size [int] -批次批量文档最大大小 +每个 Sink Writer 在发送一次 Bulk API 请求前缓冲的最大文档数,默认值为 `10`。该参数按文档数计量,不是字节数限制。 + +批量导入时,建议显式设置此参数,并使用有代表性的数据逐步增大批大小进行测试。比较结果时,保持并行度和索引设置一致。例如: + +```hocon +sink { + Elasticsearch { + hosts = ["http://localhost:9200"] + index = "batch-import" + max_batch_size = 1000 + } +} +``` + +`1000` 是用于测试的起点,并非所有场景下的最优值。增大批次可以分摊每次请求的开销,也会增加缓冲内存及低流量输入等待凑满批次的时间。评估时需同时考虑文档大小和并发的表级 Writer;限制文档数不能限制 HTTP 请求的字节数。批大小选择方法见 Elasticsearch 官方的[写入性能指南](https://www.elastic.co/docs/deploy-manage/production-guidance/optimize-performance/indexing-speed)。 + +批任务结束时会刷新剩余文档。Zeta 上的低流量流任务可参考[Zeta 定时刷新](#zeta-定时刷新),通过 `sink.flush.interval` 配置独立于批大小阈值的刷新间隔。 ### tls_verify_certificate [boolean]
