文件计数不一致 [英] Inconsistent doc count

查看:70
本文介绍了文件计数不一致的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行Elasticsearch 1.5.2

Hi I am running Elasticsearch 1.5.2

我在其中一个索引中索引了6,761,727个文档.

I indexed 6,761,727 documents in one of my indexes.

当我运行以下查询时......

When I run the following query....

GET myindex/mytype/_search
{
    "size": 0
}

hits.total总数保持2个值之间的交替...

The hits.total count keeps alternating between 2 values...

"hits": {
    "total": 6761727,
    "max_score": 0,
    "hits": []
}

"hits": {
    "total": 6760368,
    "max_score": 0,
    "hits": []
}

无论我运行查询多少次,计数都在2之间来回移动.

No matter how many times I run the query the count goes back and forth between the 2.

我仔细搜索了一下,发现主分片与副本分片似乎没有完全相同的文档数量.如果我使用preference = primary,则返回的文档数是正确的.

I searched around a bit and found out that it seems that primary vs replica shards don't have exact same number of docs. If I use preference=primary then the doc count returned is correct.

最简单的方法是检查罪魁祸首是哪个碎片,并尝试在不重新索引所有内容的情况下修复该碎片?

What is the easiest way to check which shard is the culprit and try to fix him without re-indexing everything?

推荐答案

将该索引的副本计数设置为0

Set the replica count to 0 for that index

PUT /my_index/_settings
{
  "index": {
    "number_of_replicas": 0
  }
}

等待 GET/_cat/shards/my_index?v ,然后再设置为初始副本数时,不再看到该索引的副本.

wait to see no more replicas for that index when you do GET /_cat/shards/my_index?v and then set back to the initial number of replicas.

这将删除该索引的所有副本,然后为主副本创建一个新副本.

This will delete all the replicas for that index and then make a new copy of the primaries.

这篇关于文件计数不一致的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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