"reason":"No handler for type [attachment] declared on field [file]" 最完全解决方案

0、elasticsearch-mapper-attachments 2.3.4安装

mapper-attachments安装方法分两类,在线和离线:

  • 在线安装
bin/elasticsearch-plugin install mapper-attachments
  • 离线安装
bin/elasticsearch-plugin install file:///path/to/mapper-attachments-2.3.4.zip

插件下载地址见:ES插件elasticsearch-mapper-attachments 2.3.4及各个版本正确下载地址

1、插入attachment mapping时,报错

报错详情:

{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [attachment] declared on field [file]"}],
"type":"mapper_parsing_exception","reason":"No handler for type [attachment] declared on field [file]"},"
status":400}

具体引起报错的指令:

curl -XPUT http://88.88.88.88:9200/test/person/_mapping -d '{
    "person": {
    "properties": {
    "file": {
    "type": "attachment",
    "path": "full",
    "fields": {
    "file": {
    "type": "string",
    "term_vector":"with_positions_offsets",
    "store": true
}}}}}}'

可以看到中间的attachment类别无法识别。

那么最完全解决方案是我总结如下:

  • 是否重启ES

大部分插件在重启后,ES才会在初始化过程中加载plugins。

  • 查看重启日志,查看是否存在mapper-attachments关键词
[node-es-xxxx-pub03] modules [reindex, lang-expression, lang-groovy], plugins [elasticsearch-analysis-ansj, mapper-attachments, kopf, analysis-ik], sites [elasticsearch-analysis-ansj, kopf]

可以看到,该插件是正常加载的。

  • curl查看节点plugins信息,查看插件是否安装正确
[xxxx@hostname estest]$ curl -XGET 88.88.88.88:9200/_cat/plugins?v
name               component                   version type url                                                                     
node-es-xxx-pub01 analysis-ik                 1.9.4   j                                          
node-es-xxx-pub01 gui                         2.0.0   s    /_plugin/gui/                         
node-es-xxx-pub01 kopf                        2.0.1   s    /_plugin/kopf/                        
node-es-xxx-pub01 mapper-attachments          2.3.4   j 
……
……

可以看到,我们的插件是安装正确的。

  • 是否是集群?集群需要集群重启(还有一种可能是master节点必须重启)

集群所有节点都重启有可能不需要,时间紧张我也没时间去测了,反正我都重启了一遍。

这里我觉得只需要对master节点重启。因为如果调用es集群中的slave节点的es服务,对应它也会转到master节点来处理任务,毕竟只有master节点的log在刷新。

 

----------------------------------------------------------------------

至此,问题解决,重启了集群

 

转载于:https://www.cnblogs.com/zklidd/p/6113690.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值