DBAtlas · 数据库运维图谱

strict_dynamic_mapping_exception: strict_dynamic_mapping_exception: mapping set to strict, dynamic introduction of [...] within [...] is not allowed(mapping 设为 strict,不允许动态添加字段)

Elasticsearch

含义

由于索引或对象的 mapping 设为 "dynamic": "strict",包含 mapping 中未定义新字段的文档被拒绝。strict 模式可防止 schema 之外的字段被静默添加。

原因

在 mapping 为 dynamic:strict 时,文档中发送了 mapping 中不存在的字段(拼写错误、新字段、意外字段)。这通常是为严格控制 schema 而有意设置的保护措施。

解决方法

修正或删除文档中多余/拼写错误的字段。如果确实需要该字段,先将其添加到 mapping:PUT /index-name/_mapping {"properties": {"new_field": {"type": "..."}}}。如果希望自动添加新字段,将 dynamic 设为 "true";如果希望存储但不索引,设为 "false"。有意识地使用 strict 模式以保持 schema 规范。

在 DBAtlas 中打开 →

同一数据库的其他条目