环境:
- spring boot
- elasticsearch-rest-high-level-client-6.6.0.jar
报错日志:
Elasticsearch exception [type=index_not_found_exception, reason=no such index]
解决方式:
// 创建搜索请求
SearchRequest searchRequest = new SearchRequest(index,type);
改成
// 创建搜索请求
SearchRequest searchRequest = new SearchRequest(index);
本文介绍了在SpringBoot应用中使用elasticsearch-rest-high-level-client遇到的IndexNotFoundException错误,重点讲解了如何通过调整搜索请求构造来避免此类问题,只需指定索引名即可。
1万+

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



