写入 ES 嵌套文档超限(默认10000个)如何处理?

作者: 刘一二 发布时间: 2023年4月9日 浏览: 995

今天商品同步ES 计划任务报错:

The number of nested documents has exceeded the allowed limit of [10000]. 
This limit can be set by changing the [index.mapping.nested_objects.limit] index level setting.

查看该商品款式(Color,Size, ... 排列组合)较多,每个款式下都配了十几张的图片,这些款式及图片都以嵌套文档的方式写入了ES,导致写入ES的嵌套文档总数超限。

 

官方对 index.mapping.nested_objects.limit 的介绍:

https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-settings-limit.html

 

处理方法:

跟据官方文档描述,修改 index.mapping.nested_objects.limit 配置项即可

新建索引时指定

PUT /xxxxx
{
  "settings": {
    "index.mapping.nested_objects.limit": 60000,
    "number_of_shards": 5,
    "number_of_replicas": 2
  },
  "mappings": {
    ...
  }
}

 

对已存存的索引进宪修改

PUT xxxx/_settings
{
  "index.mapping.nested_objects.limit": 60000
}

 

最新文章
热门文章
热门搜索
猜你喜欢
导航