强制对ES的mapping加了dynamic:strict限制后,突然报了Mapping Set to Strict, Dynamic Introduction of [_Class] Within [_Doc] Is Not Allowed.
官方解释:
Mapping uses type hints embedded in the document sent to the server to allow generic type mapping. Those type hints are represented as _class attributes within the document and are written for each aggregate root.
说白了就是说需要_class 字段来做一个标识.
所以解决方式就有了,其实就是少了_class字段.加上就好了.
"properties": { "_class" : { "type" : "keyword" } }