我遇到了几个具有相同“document_missing_exception”问题的问题,但看起来在我的情况下它们不是同一个问题。我可以查询该文档,但当我尝试更新它时失败。我的查询:
# search AuthEvent by sessionID
GET events-*/_search
{
"size": "100",
"query": {
"bool": {
"must": [{
"term": {
"type": {
"value": "AuthEvent"
}
}
},
{
"term": {
"client.sessionID.raw": {
"value": "067d660a1504Y67FOuiiRIEkVNG8uYIlnK87liuZGLBcSmEW0aHoDXAHfu"
}
}
}
]
}
}
}
Run Code Online (Sandbox Code Playgroud)
查询结果:
{
"took" : 18,
"timed_out" : false,
"_shards" : {
"total" : 76,
"successful" : 76,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : 1,
"max_score" : 6.705622,
"hits" : [
{
"_index" : "events-2020.10.06",
"_type" : "doc",
"_id" : "2c675295b27a225ce243d2f13701b14222074eaf",
"_score" : 6.705622,
"_routing" : "067d660a1504Y67FOuiiRIEkVNG8uYIlnK87liuZGLBcSmEW0aHoDXAHfu",
"_source" : {
# some data
}
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
更新请求:
POST events-2020.10.06/_doc/2c675295b27a225ce243d2f13701b14222074eaf/_update
{
"doc" : {
"custom" : {
"testField" : "testData"
}
}
}
Run Code Online (Sandbox Code Playgroud)
并更新结果:
{
"error" : {
"root_cause" : [
{
"type" : "document_missing_exception",
"reason" : "[_doc][2c675295b27a225ce243d2f13701b14222074eaf]: document missing",
"index_uuid" : "5zhQy6W6RnWscDz7Av4_bA",
"shard" : "1",
"index" : "events-2020.10.06"
}
],
"type" : "document_missing_exception",
"reason" : "[_doc][2c675295b27a225ce243d2f13701b14222074eaf]: document missing",
"index_uuid" : "5zhQy6W6RnWscDz7Av4_bA",
"shard" : "1",
"index" : "events-2020.10.06"
},
"status" : 404
}
Run Code Online (Sandbox Code Playgroud)
我对 ElasticSearch 还很陌生,找不到这种行为的任何原因。我使用ElasticSearch 6.7.1 oss版本+ Kibana来操作数据。我也尝试过批量更新,但以同样的错误结束。
正如您在查询结果中看到的,您的文档已使用某个 routing值建立索引,但您在更新请求中缺少该值。
试试这个:
POST events-2020.10.06/_doc/2c675295b27a225ce243d2f13701b14222074eaf/_update?routing=067d660a1504Y67FOuiiRIEkVNG8uYIlnK87liuZGLBcSmEW0aHoDXAHfu
{
"doc" : {
"custom" : {
"testField" : "testData"
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果文档使用routingvalue进行索引,则所有后续获取、更新和删除操作也需要使用该路由值进行。
| 归档时间: |
|
| 查看次数: |
13892 次 |
| 最近记录: |