通过 Postman 在弹性搜索中重新索引 500 万个项目:超时

Reindexing 5M items in elastic search through Postman: times out

我的索引 v1 中有大约 500 万个项目。我创建了一个略有改动的新索引 v2。 我正在尝试重新索引 v1 --> v2 中的所有项目。

curl -XPOST 'localhost:9200/_reindex?pretty' -H 'Content-Type: application/json' -d'
{
  "source": {
    "index": "twitter"
  },
  "dest": {
    "index": "new_twitter"
  }
}
'

当我尝试这样做时,只有 160 万个项目被重新编入索引。操作超时。我该如何解决?

您应该使用 reindex docs 中提到的 wait_for_completion=false 参数。它允许您 运行 在后台重新索引请求,而您的 HTTP 客户端不会被迫等待和阻止并可能超时。