弹性搜索索引的领域太多? [英] Too many fields bad for elasticsearch index?

查看:95
本文介绍了弹性搜索索引的领域太多?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请说我有一千个键,我想要存储相关的值。直观的方法似乎是像

  {
key1:someval,
key2:someotherval,
...
}

这是弹性搜索索引的不好的设计模式有数千个键?每个按键引入的方式会为索引下的每个文档创建开销?

解决方案

如果你知道有一个上限您将拥有的密钥数量,几千个字段不是问题。



问题是当您有无限制的密钥时,例如当键值从一个值导出时,您将拥有不断增长的映射,从而也将具有集群状态。这也可能导致古怪的搜索。



这是一个常见的问题/问题,我在我的文章中为疑难解答Elasticsearch搜索,初学者



简而言之,成千上万的字段是没有问题的 - 没有控制映射。


Let say I have a thousand keys, and I would want to store the associated values. The intuitive approach seems to be something like

{
   "key1":"someval",
   "key2":"someotherval",
    ...
}

Is this a bad design pattern for elasticsearch index to have thousands of keys? Would each keys introduced this way create overhead for every documents under the index?

解决方案

If you know there is an upper limit to the number of keys you'll have, a few thousand fields is not a problem.

The problem is when you have an unbounded set of keys, e.g. when the key is derived from a value, as you'll have a continuously growing mapping and thus also cluster state. It can also lead to quirky searches.

This is a common enough question/issue that I dedicated a section to it in my article on Troubleshooting Elasticsearch searches, for Beginners.

In short, thousands of fields is no problem - not having control of the mapping is.

这篇关于弹性搜索索引的领域太多?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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