Elasticsearch 文档的最大大小是多少? [英] What is the maximum Elasticsearch document size?

查看:168
本文介绍了Elasticsearch 文档的最大大小是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了有关 Lucene 仅限于 2Gb 文档的说明.Elasticsearch 中可索引的文档大小是否有任何其他限制?

I read notes about Lucene being limited to 2Gb documents. Are there any additional limitations on the size of documents that can be indexed in Elasticsearch?

推荐答案

Lucene 在内部使用字节缓冲区,该缓冲区使用 32 位整数进行寻址.根据定义,这限制了文档的大小.所以理论上 2GB 是最大的.

Lucene uses a byte buffer internally that uses 32bit integers for addressing. By definition this limits the size of the documents. So 2GB is max in theory.

在 ElasticSearch 中:

ES GitHub代码中有一个max http request size,针对Integer.MAX_VALUE2^31-1设置>.因此,基本上,2GB 是通过 HTTP 进行批量索引的最大文档大小.此外,ES 在完成之前不会处理 HTTP 请求.

There is a max http request size in the ES GitHub code, and it is set against Integer.MAX_VALUE or 2^31-1. So, basically, 2GB is the maximum document size for bulk indexing over HTTP. And also to add to it, ES does not process an HTTP request until it completes.

良好做法:

  • 如果可以,请不要使用非常大的 Java 堆:仅将其设置为必要的大小(理想情况下不超过机器 RAM 的一半),以容纳您使用 Elasticsearch 的总体最大工作集大小.这为操作系统留下了剩余的(希望相当大的)RAM 来管理 IO 缓存.
  • 在客户端,始终使用批量 API,它在一个请求中为多个文档编制索引,并试验每个批量请求发送的正确数量的文档.最佳大小取决于许多因素,但尽量朝着太少而不是太多文档的方向出错.将并发批量请求与客户端线程或单独的异步请求一起使用.

如需进一步研究,请参阅以下链接:

For further study refer to these links:

  1. elasticsearch 索引的性能注意事项

通过 HTTP 进行批量索引的文档最大大小

这篇关于Elasticsearch 文档的最大大小是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆