java操作es写入数据报错如下:
org.elasticsearch.action.ActionRequestValidationException: Validation Failed: 1: type is missing;2: type is missing;3: type is missing;4: type is missing;5: type is missing;6: type is missing;7: type is missing;8: type is missing;9: type is missing;10: type is missing;11: type is missing;12: type is missing;13: type is missing;14: type is missing;15: type is missing;16: type is missing;17: type is missing;18: type is missing;19: type is missing;20: type is missing;21: type is missing;22: type is missing;23: type is missing;24: type is missing;25: type is missing;26: type is missing;27: type is missing;28: type is missing;29: type is missing;30: type is missing;
at org.elasticsearch.action.bulk.BulkRequest.validate(BulkRequest.java:614) ~[elasticsearch-6.8.6.jar:6.8.6]
at org.elasticsearch.client.RestHighLevelClient.performRequest(RestHighLevelClient.java:1730) ~[elasticsearch-rest-high-level-client-6.8.6.jar:6.8.6]
后分析查看报错信息发现,打印日志中使用的es版本为6.8.6(2.2.5.RELEASE版本默认使用的es版本),而我们使用的7.6.1中的一些调用方式,所以导致报错。
解决:修改es版本为7.6.1

再次启动,测试,ok问题解决。
在尝试使用Java操作Elasticsearch时遇到批量写入数据报错,原因是使用的ES客户端版本(6.8.6)与实际ES服务器版本(7.6.1)不匹配,导致`type is missing`的问题。解决方法是将ES客户端版本更新到与服务器相同的7.6.1版本。更新后重新启动并测试,问题得到解决。
1381

被折叠的 条评论
为什么被折叠?



