您快到了:该值需要设置为
strict。正确的用法如下:
PUT /test_idx{ "mappings": { "test_type": { "dynamic":"strict", "properties": { "field1": { "type": "string" } } } }}再进一步说明一下,如果您想甚至禁止创建新类型,不仅要禁止该索引中的字段,请使用以下命令:
PUT /test_idx{ "mappings": { "_default_": { "dynamic": "strict" }, "test_type": { "properties": { "field1": { "type": "string" } } } }}没有
_default_模板:
PUT /test_idx{ "settings": { "index.mapper.dynamic": false }, "mappings": { "test_type": { "dynamic": "strict", "properties": { "field1": { "type": "string" } } } }}


