强制对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"
   }
}

 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐