简体   繁体   English

为什么Elasticsearch的字段数限制为1000

[英]Why has Elasticsearch put a limit of 1000 on number of fields

  1. Why has Elasticsearch put a limit of 1000 on the total number of fields? 为什么Elasticsearch将字段总数限制为1000?
  2. Will it cause any degradation in performance? 会导致性能下降吗?
  3. If it will, why? 如果可以,为什么? There is no such limit in lucene. Lucene没有这种限制。

Also, can someone please explain these settings more in detail. 另外,有人可以详细解释这些设置。

I believe the explanation from the documentation itself is pretty good when it comes to these settings. 对于这些设置,我相信来自文档本身解释是相当不错的。

There are situation where the mapping of indices is dynamic (logging use cases usually or some rogue documents generator in the users' infrastructure) and having it like this could lead to hundreds of thousands of fields in indices. 在某些情况下,索引的映射是动态的(通常记录用例或用户基础架构中的某些恶意文档生成器),并且这样的操作可能导致索引中成千上万个字段。 When this usually happens, only a handful of documents have values in those gazillion fields, while most of the documents don't. 通常发生这种情况时,只有少数几个文档在这些庞大的字段中具有值,而大多数文档则没有。 This, from the disk usage point of view, is not a great thing. 从磁盘使用的角度来看,这不是一件好事。 Why this could be a problem, again is very well explained in another section of the documentation . 在文档的另一部分中再次很好地解释了为什么这可能是一个问题。

The bad part, though, is that most of the times the users didn't plan or didn't expect to have such a high number of fields and the soft limit we introduced for fields count is to protect users in these scenarios from hurting themselves unintentionally. 不过,不利的一面是,大多数情况下用户不计划或不希望拥有如此多的字段,而我们为字段计数引入的限制是为了保护这些情况下的用户免受伤害无意的。

If you have a well thought mapping for your indices and you know those 1000 fields limit is not for you, you can change it to a number that fits your use case and scenario: 如果您对索引有一个深思熟虑的映射,并且知道那1000个字段限制不适合您,则可以将其更改为适合您的用例和方案的数字:

PUT /test/_settings { "index.mapping.total_fields.limit": 2000 }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM