用springboot整合es使用nested映射类型错误问题

问题遇到的现象和发生背景

用springboot整合es时,es使用的是7.9.3版本,使用的实体类映射Document的方式,由于需要关联,使用的是内嵌对象类型Nested,然后发现有多个nested对象中属性和java预设属性不一致的问题,我使用的@filed注解指明是keyword也还是一样,而且createIndex = false,elasticsearchOperations.save(对象);时,还是自动构建mapping以及插入了不正确格式的内容

问题相关代码,请勿粘贴截图

@ApiModelProperty(value = "有效期止")
    @Field(type = FieldType.Keyword,name = "expirationDate")
    private String expirationDate;
运行结果及报错内容
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"failed to parse field [commontaxpayerList.expirationDate] of type [date] in document with id '163353740'. Preview of field's value: '-'"}],"type":"mapper_parsing_exception","reason":"failed to parse field [commontaxpayerList.expirationDate] of type [date] in document with id '163353740'. Preview of field's value: '-'","caused_by":{"type":"illegal_argument_exception","reason":"failed to parse date field [-] with format [strict_date_optional_time||epoch_millis]","caused_by":{"type":"date_time_parse_exception","reason":"Failed to parse with all enclosed parsers"}}},"status":400}
我的解答思路和尝试过的方法

反复检查,字段类型和@Field注解指定的类型

我想要达到的结果

以上字段不为date的mapping,而是映射到string类型

手动构建索引mapping可控性更高,你这明显是内嵌结构创建索引的时候没有正确解析,动态结构自适应就是以第一次插入时的数据格式类型为字段类型,你应该第一次写进去了一个日期格式的数据被解析成date了,顺带提一句@field上的type只在createindex时有用后面改没用

参考一下: