elasticsearch 在迁移数百万个文档时,使用elasticcluster的远程重建索引API的最佳方法是什么?

5cg8jx4n  于 2022-12-03  发布在  ElasticSearch
关注(0)|答案(1)|浏览(104)

我有一个索引中大约有1亿个文档,我想使用reindex API将其迁移到新的集群。我想以节流的方式进行迁移。
我尝试使用request_per_seconds100000,但完成整个过程需要几个小时。Q.1我可以使用request_per_seconds1000000 来减少处理时间吗?Q.2有没有更好的方法可以用来以节流方式更好地重新建立索引?

t5zmwmid

t5zmwmid1#

重建索引支持切片滚动以并行化重建索引过程。这种并行化可以提高效率,并提供一种将请求分解为较小部分的方便方法。

POST _reindex?slices=5&refresh
{
  "source": {
    "index": "my-index-000001"
  },
  "dest": {
    "index": "my-new-index-000001"
  }
}

https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html#docs-reindex-automatic-slice
您还可以阅读有关优化速度的建议,例如:

  • 禁用该时段的刷新
  • 将副本减少到0等。

链接:
https://www.elastic.co/guide/en/elasticsearch/reference/current/tune-for-indexing-speed.html

相关问题