【问题标题】:Elasticsearch _reindex API not copying documentsElasticsearch _reindex API 不复制文档
【发布时间】:2018-07-09 23:35:01
【问题描述】:

根据文档 (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/reindex-upgrade.html),我正在尝试将旧的 1.5 弹性索引升级到 6.0 我可以在 6.0 中创建一个新索引,然后使用远程重新索引 (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/reindex-upgrade-remote.html) 使用远程重新索引 (https://www.elastic.co/guide/en/elasticsearch/reference/6.0/reindex-upgrade-remote.html)

这两个实例都在 docker 容器中运行我只是想在本地进行测试,然后再在生产环境中进行实际操作

我可以看到在我的旧索引中索引了一些文档。

curl -XGET 'http://localhost:9200/old_index/_search?pretty'

{
  "took" : 8,
  "timed_out" : false,
  "_shards" : {
    "total" : 5,
    "successful" : 5,
    "failed" : 0
  },
  "hits" : {
    "total" : 1,
    "max_score" : 1.0,
    "hits" : [ {
      "_index" : "old_index",
      "_type" : "item",
      "_id" : "92",
      "_score" : 1.0,
      "_source":{"user_id":3,"slug":"asdfaisjeilej","name":"lake.jpgasdad","item_type":"image","created_at":"2018-01-23T18:11:30Z","deleted_at":null,"content_length":1252171}
    }]}
}

在我的 elasticsearch 6.0 实例中创建一个新索引 (new_index) 后,使用略有差异的映射(将字符串类型更改为文本),然后我使用以下命令继续从远程重新索引。 (请注意,我的其他实例在端口 9400 中运行)

curl -XPOST 'localhost:9400/_reindex?pretty' -H 'Content-Type: application/json' -d'
{
  "source": {
    "remote": {
      "host": "http://localhost:9200"
    },
    "index": "old_index"
  },
  "dest": {
    "index": "new_index"
  }
}

我收到以下回复

{
  "took" : 136,
  "timed_out" : false,
  "total" : 0,
  "updated" : 0,
  "created" : 0,
  "deleted" : 0,
  "batches" : 0,
  "version_conflicts" : 0,
  "noops" : 0,
  "retries" : {
    "bulk" : 0,
    "search" : 0
  },
  "throttled_millis" : 0,
  "requests_per_second" : -1.0,
  "throttled_until_millis" : 0,
  "failures" : [ ]
}

所以基本上,old_index 中的文档不会被复制到 new_index,我不知道为什么会这样。有没有我遗漏的步骤,我正在按照他们显然阅读的方式关注 elasticsearch 文档。

【问题讨论】:

  • 您确定在新的 ES 6 集群中配置了 reindex.remote.whitelist 吗?
  • 是的,这就是所有设置并指向9200
  • 本地还有 docker 容器吗?
  • 是的,两个容器都在本地。我注意到,如果我尝试使用不存在的目标索引,我会不断得到成功的响应,而不是 index_not_found 异常。所以我想知道这是否是弹性本身的问题。
  • 我也有同样的问题。这需要一个答案。

标签: elasticsearch


【解决方案1】:

正如我所提到的,我在没有 docker 的暂存环境中测试了远程重新索引后,在从 Elasticsearch-2 迁移到 Elasticsearch-6 时也遇到了同样的问题。 我的解决方法是创建一个旧版本的实例(不在 docker 上),从备份中加载它并从它重新索引到不在 docker 上运行的 elasticsearch 6 实例。

如果您仍想在 docker 上运行 elasticsearch 6,您可以随时将数据挂载到您的容器中。

希望对您有所帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-04
    • 1970-01-01
    • 2021-10-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 2023-04-04
    • 1970-01-01
    相关资源
    最近更新 更多