问题描述:

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以后版本

相关文章:

  • 2021-11-13
  • 2021-05-30
  • 2022-01-15
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
猜你喜欢
  • 2021-09-27
  • 2021-10-27
  • 2021-04-20
  • 2021-12-05
  • 2021-12-06
  • 2021-08-29
相关资源
相似解决方案