首页 文章

Elasticsearch:删除索引并在不正确的数据中重新创建相同的索引结果

提问于
浏览
0

我使用elasticsearch-2.3.2

我创建了我的索引http://localhost:9200/github_inactivusr-2017.03.21

命令

curl http://localhost:9200/github_inactivusr-2017.03.21/_search

表示我的索引中总共有7650个条目

{
  "took" : 40,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 7650,
    "max_score" : 1.0,
...
}

我删除了这个索引

curl -X DELETE http://localhost:9200/github_inactivusr-2017.03.21

我收到了消息

{“承认”:真实}

当我执行

curl http://localhost:9200/_cat/indices

我明白了

red    open stats-new_format_membership-2016.08.12    5 1
red    open stats-json3-jira-users-2017.07.13         5 1
yellow open github_activusr-2017.03.21               5 1  80495 0  16.6mb  16.6mb
yellow open github_activusr-2017.07.24               5 1  34697 0   9.3mb   9.3mb

不再列出索引github_inactivusr-2017.03.21

然后我再次使用2550个条目重新创建索引“github_inactivusr-2017.03.21”(完全相同的名称和相同的映射)

但是,当我使用命令 curl http://localhost:9200/github_inactivusr-2017.03.21/_search 时,我仍然总共得到7650个条目 .

重新创建索引后,如果我执行命令:

curl http://localhost:9200/_cat/indices

我明白了

red    open stats-new_format_membership-2016.08.12    5 1
red    open stats-json3-jira-users-2017.07.13         5 1
yellow open github_activusr-2017.03.21               5 1  80495 0  16.6mb  16.6mb
yellow open github_activusr-2017.07.24               5 1  34697 0   9.3mb   9.3mb
yellow open github_inactivusr-2017.03.21             5 1   7650 0   1.6mb   1.6mb

好像索引没有被正确删除 . 即使我在重新创建索引之前停止并重新启动elasticsearch,我也会遇到这种情况 . 就好像有一个缓存或任何不能摆脱数据的东西 .

有谁有想法吗 ?

1 回答

  • 0

    我找到了根本原因 . 该问题与我使用的logstash配置文件有关 . 它重新注入相同数据的3倍,这解释了7650(2550 * 3)

    抱歉时间和感谢@Val

相关问题