java向es中写入数据报错org.elasticsearch.action.ActionReque问题
作者:要么出众,要么出局
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问题解决。
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。