我有点怀疑你在刷屏

索引中存在某doc,但是使用update更新时提示document_missing_exception

Elasticsearch | 作者 tinyzhe | 发布于2019年03月02日 | 阅读数:18432

我的集群情况如下:
节点:3,数据:5w条,分片:5,副本:1
当对一条存在的doc使用update更新时,提示我找不到该数据
TIM图片20190302164617.png


TIM图片20190302164624.png

 
但是我在请求上加上路由后,却可以正常删除

TIM截图20190302164711.png

 
由于我的业务在update请求时不会去拿routingId,请教下各位大佬,到底是什么原因导致的,有什么解决办法吗?
已邀请:

code4j - coder github: https://github.com/rpgmakervx

赞同来自: tinyzhe

更新删除的时候,会现做一个get操作。get操作中,如果不指定路由,就会使用_id的值作为路由。
 
能看出你使用了province作为路由值,所以更新删除必须带着这个才行,否则es不知道这个文档再哪个分片上,也就更新失败了。

laoyang360 - 《一本书讲透Elasticsearch》作者,Elastic认证工程师 [死磕Elasitcsearch]知识星球地址:http://t.cn/RmwM3N9;微信公众号:铭毅天下; 博客:https://elastic.blog.csdn.net

赞同来自: tinyzhe

原因:路由相关——routing

Routing is used to route the update request to the right shard and sets the routing for the upsert request if the document being updated doesn’t exist. Can’t be used to update the routing of an existing document
 
解决方案:指定路由吧。

lemon123

赞同来自:

你好,我也出现了类似问题,我想删除ES里面的一条数据,根据你的信息在_update后面加入routing=** 之后数据确实可以修改了,但是我在做删除的时候无法删除,提示也是报路由错误,不知道删除的时候这个routing 怎么设置?
222.jpg


Snipaste_2020-09-16_09-58-35.jpg


333.jpg

 

要回复问题请先登录注册