限制Elasticsearch中的嵌套字段 [英] Limiting the nested fields in Elasticsearch

查看:126
本文介绍了限制Elasticsearch中的嵌套字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在具有动态映射的ElasticSearch中为json文档建立索引.有些文档具有无法预测的键数(嵌套级别),因此我开始从ES Java api收到此错误.

I am trying to index json documents in ElasticSearch with dynamic mappings on. Some of the documents have unpredictable number of keys (nested levels) because of which I started getting this error from ES Java api.

[ElasticsearchException [Elasticsearch异常[type = illegal_argument_exception,原因=超出索引[my_index]中的总字段[1000]]的限制]]]]批量执行失败

我想知道是否可以在索引级别配置一个选项,在该选项中,我可以定义为仅在特定级别(可能为2)之前扫描字段,并将文档的其余部分存储为字符串或拼合形式.我确实遇到过一些设置,例如 index.mapping.depth.limit ,但是如果将其设置为2,则似乎有更多级别,但该设置会拒绝文档.链接

I was wondering if there is an option which can be configured at index level where I can define to scan for fields only till certain level (maybe 2) and store the rest of the document as a string or in flattened form. I did come across some settings like index.mapping.depth.limit but it seems if I set it to 2, this setting rejects the document if there are more levels. link

推荐答案

总计字段

PUT <index_name>/_settings
{
  "index.mapping.total_fields.limit": 2000
}

用于深度限制

PUT <index_name>/_settings
{
  "index.mapping.depth.limit": 2
}

https://www.elastic.co/guide/en/elasticsearch/reference/master/mapping.html

这篇关于限制Elasticsearch中的嵌套字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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