解决Elasticsearch报错:exception [type=search_phase_execution_exception, reason=all shards failed]
关于exception [type=search_phase_execution_exception, reason=all shards failed]这个es错误我是如何解决的!
由于服务器性能不佳,导致我的es挂了一次,将es修复后发现搜索功能出现了问题,错误日志内容如下:
服务器发生异常:ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]];
发现这个错误好长时间了,因为最近比较忙,一直没有顾上去解决它,今天我分享一下我是如何解决这个问题的.
首先将异常级别升级到最高:Throwable
try {response = client.search(searchRequest, RequestOptions.DEFAULT);} catch (Throwable e) {throw new RuntimeException(e);}
此时错误日志打印的比较详细,内容会变成这个样子:
服务器发生异常:ElasticsearchStatusException[Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [created] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]]; nested: ElasticsearchException[Elasticsearch exception [type=illegal_argument_exception, reason=Fielddata is disabled on text fields by default. Set fielddata=true on [created] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead.]];
此时我们可以进准的定位到是mapping的哪个字段有问题,我的这里是created,错误原因是我将created设置成了text,但是它的fielddata没有设置成true
接下来只要将这个字段的fielddata设置为true即可
{"properties": {"created": { "type":"text","fielddata": true}} }
虽然篇幅比较短但是比较实用!!!
解决Elasticsearch报错:exception [type=search_phase_execution_exception, reason=all shards failed]相关推荐
- ES使用聚合查询报错exception [type=search_phase_execution_exception, reason=all shards failed]
首先看聚合查询写的代码 聚合查询 使用的是tags这个字段分组查询,使用term查询. term查询的话必须查询的字段是keyword类型,而且在java代码后面需要加入.keyword. text是 ...
- [Elasticsearch exception [type=search_phase_execution_exception, reason=all shards failed]]
现象 在做某一次用到elasticsearch的地位位置搜索时,报错: ElasticsearchStatusException[Elasticsearch exception [type=searc ...
- 解决gensim报错AttributeError: type object ‘Word2Vec‘ has no attribute ‘load_word2vec_format‘
解决方法 将报错的 from gensim.models import Word2Vecmodel = Word2Vec.load_word2vec_format('test.bin.gz', bin ...
- 解决SecureCRT报错keyboard-interactive authentication with the ssh2 server failed
Option ->Session Options ->Connection-> SSH2,选择Authentication,勾选Password,双击Properties输入两次密码 ...
- ES时间查询报错 - “caused_by“:{“type“:“illegal_argument_exception“,“reason“:“failed to parse date field
项目场景: 在ES的使用过程中,用到了时间范围的查询功能,出现时间解析错误的报错信息:"caused_by":{"type":"illegal_arg ...
- elasticsearch报错expected <block end>, but found BlockMappingStart解决方法
elasticsearch报错expected , but found BlockMappingStart解决方法 参考文章: (1)elasticsearch报错expected , but fou ...
- java argument type mismatch_解决mybatisplus插入报错argument type mismatch的问题
今天使用argument type mismatch发现插入的时候报错 java.lang.IllegalArgumentException: argument type mismatch 从错误中看 ...
- laradock build elasticsearch 报错 unknown setting [cluster.initial_master_nodes] 的解决办法
laradock build elasticsearch 报错 unknown setting [cluster.initial_master_nodes] please check that any ...
- 记一次docker启动elasticsearch报错解决方法
docker启动elasticsearch报错,启动命令及报错信息如下 启动命令如下 docker run -d --name elasticsearch-6.4.0 -p 9200:9200 -p ...
最新文章
- 通道注意力机制 cnn keras_【CV中的Attention机制】简单而有效的CBAM模块
- 初步了解Linux创建文件系统命令
- 产品经理十二时辰:内容过于真实,扎心了!
- LCN分布式事务框架实战
- 使用Idea添加PYTHONPATH的一种方案
- 医药吧网API接口开放
- 前端工程化/构建自动化
- 如何安装Stata 15及网状Meta包 最新图文教程一看就会
- java有关物流管理的简历_Java开发实习生大学生简历模板
- MATLAB2016笔记(十一):基本粒子群优化算法(PSO)的MATLAB实现
- 联通鸿蒙卡怎么样,联通不限流量卡,联通无限流量,正规资费
- 【数据分析】系列-Python分析淘宝4200款Bra(没错,就是文胸)后,发现最好卖的款式居然是。。。
- matlab图像进行变换
- windows命令获取帮助_如何在Windows 10中获得帮助
- 三字经全文(此版本是读诵最多的)
- win7正版版本分析
- 如何下载河北区卫星地图高清版大图
- 利用ArcGIS对shp文件进行投影转换
- DTIs(药物靶标关联)预测,在机器学习中的常用方法。(一)
- 论文笔记:Low-Rank Tensor Constrained Multiview Subspace Clustering