使用springboot-data-elasticsearch遇到的几个bug
1 Rejecting mapping update to [dsp_clue_relation] as the final mapping would have more than 1 type。
楼主在springboot中使用elasticsearch时候报错,网上搜了下是同一个index也就是dsp_clue_relation下面有多个type,后来发现是之前在model里面使用document注解创建了索引dsp_clue_relation,然后我删掉这个注解之后又在另一个model使用document注解,索引也是dsp_clue_relation,但是我已经运行过项目在es里面建立了这个索引,所以就冲突了。解决方法就是到es里面删除索引,delete dsp_clue_relation。
2 Validation Failed: 1: no requests added
这个错误是调用ElasticsearchRepository的saveAll()的数据为空时 ,会报这个错误。可以加一个if条件判断,只有数据不为空才调用saveAll() 。