首页 > 其他 > 详细

elasticsearch报错

时间:2020-08-18 21:35:23      阅读:277      评论:0      收藏:0      [点我收藏+]

问题描述:

Suppressed: org.elasticsearch.client.ResponseException: method [PUT], host [http://localhost:9200], URI [/search/doc/4?timeout=1m], status line [HTTP/1.1 400 Bad Request]
{"error":{"root_cause":[{"type":"invalid_type_name_exception","reason":"Document mapping type name can‘t start with ‘
‘, found: [doc]"}],"type":"invalid_type_name_exception","reason":"Document mapping type name can‘t start with ‘‘, found: [_doc]"},"status":400}
at org.elasticsearch.client.RestClient.convertResponse(RestClient.java:283)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:261)
at org.elasticsearch.client.RestClient.performRequest(RestClient.java:235)
at org.elasticsearch.client.RestHighLevelClient.internalPerformRequest(RestHighLevelClient.java:1611)
... 5 more

问题原因:

旧版本ES必须指定type,新版java api默认type为_doc

解决方案:

  1. 指定type
IndexRequest indexRequest = new IndexRequest(INDEX, TYPE);
  1. 升级es至7.x以后版本

elasticsearch报错

原文:https://www.cnblogs.com/bincoding/p/13525827.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!