Elasticsearch有时不返回现有文档 [英] Elasticsearch does not return existing document sometimes

查看:52
本文介绍了Elasticsearch有时不返回现有文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于当我按照cURL命令触发时的现有文档,我得到:

For the existing document when I fire following cURL command, I get:

root@unassigned-hostname:~# curl -XGET "http://localhost:9200/test/test3/573553/"

结果:

{
  "_index": "test",
  "_type": "test3",
  "_id": "573553",
  "exists": false
}

当我第二次执行相同的命令时,我得到:

When I fire the same command second time, I get:

root@unassigned-hostname:~# curl -XGET "http://localhost:9200/test/test3/573553/"

结果:

{
  "_index": "test",
  "_type": "test3",
  "_id": "573553",
  "_version": 1,
  "exists": true,
  "_source": {
    "id": "573553",
    "name": "hVTHc",
    "price": "21053",
    "desc": "VGNHNXkAAcVblau"
  }
}

我正在Ubuntu 12.04上使用Elasticsearch 0.90.11.

I am using Elasticsearch 0.90.11 on Ubuntu 12.04.

有人可以帮我弄清楚这个问题吗?

Could anyone please help me figuring out this problem?

推荐答案

我见过一些情况,其中弹性搜索碎片可能在网络分区或添加/更新/删除量很高(同一文档被更新/删除/彼此之间相差毫秒,可能会加速).没有干净的方法可以合并分片,相反,您只是随机选择一个赢家.检查是否是这种情况的一种方法是重复运行完全匹配查询,然后检查结果是否完全跳来跳去.

I have seen cases where elasticsearch shards can get out of sync during network partitions or very high add/update/delete volume (the same document getting updated/deleted/added within milliseconds of each other, potentially racing). There is no clean way to merge the shards, instead, you just randomly choose a winner. One way to check if this is the case is to repeatedly run a match all query and check if the results jump around at all.

如果您想掷骰子,看看会发生什么,可以将副本数设置为0,然后再增大到所使用的任何值.

If you want to roll the dice and see what happens you can set replicas down to 0 and then bump back up to whatever value you were using.

虽然这可能不是造成问题的原因,但值得注意的是,这是不依赖于弹性搜索作为主要事实来源的原因之一.

While this may not be the reason for your issue, it is worth noting this is one of the reasons not to depend on elasticsearch as your primary source of truth.

这篇关于Elasticsearch有时不返回现有文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆