记一次Elasticsearch查询报错
来源:互联网 发布:极限挑战电影 知乎 编辑:程序博客网 时间:2024/06/03 20:55
记一次Elasticsearch异常:
异常:org.elasticsearch.search.SearchParseException: No mapping found for [id] in order to sort on
出现场景:Elasticsearch库中无数据时,带过滤条件查询。
原因查找:
It only happens the first time, when you have no data, so this entity is not indexed yet by ElasticsearchMaybe we can try to catch the error, but it should not happened when you have data.In production, it should be already indexed, so there are no issue in prod
解决方式:捕捉并处理异常
代码:
@ControllerAdvice public class ExceptionHandlerAdvice { @ExceptionHandler(value = SearchParseException.class)public ResponseEntity searchParseException(SearchParseException e){ String content = e.getCause().getMessage(); Msg msg = new Msg<String>(MessageType.MSG_TYPE_FAILURE,content,null); return new ResponseEntity(msg, HttpStatus.OK); }}
阅读全文
0 0
- 记一次Elasticsearch查询报错
- elasticsearch查询:一次成功一次失败
- 运行elasticsearch报错
- ElasticSearch报错
- ElasticSearch报错
- ElasticSearch 启动报错
- elasticsearch启动报错
- 记一次报错(路径方面)
- elasticsearch创建索引报错
- 解决ElasticSearch启动报错
- ElasticSearch建立索引报错
- 记一次SQL查询
- elasticsearch报错:org.elasticsearch.index.engine.DocumentMissingException:document missing
- elasticsearch-查询
- Elasticsearch查询
- Elasticsearch查询
- ElasticSearch查询
- Elasticsearch 查询
- java应用系统单点登录
- Oracle10g出现Enterprise Manager 无法连接到数据库实例解决办法
- InputStream OutputStream 源的理解
- 6023 Automatic Judge
- poj1925(dp)
- 记一次Elasticsearch查询报错
- CodeForces
- 安装SQL Server 2005提示IIS未安装或者未启用的解决方法
- tomcat内存溢出解决方法
- 启动Tomcat6.x时manager does not exist or is not a readable directory
- 重新安装windows后,恢复ubuntu正常引导
- SpringMVC结合Freemarker在页面调用静态方法优化总结
- 树莓派Android Things物联网开发:创建一个Things项目
- 写给未来的你——老婆