简单的:

核心代码

//发送请求
ReindexRequestBuilder builder=ReindexAction.INSTANCE.newRequestBuilder(client).sourse(oldindex).destination(newindex);

解释:

1、cilent需要自行创建

2、sourse中是要迁移的索引名称

3、destination中是要迁移到的新索引名称。

延伸:

在此基础上还可以继续

.setSlices(3).refresh(true)

可以定义切片数量,提高reindex的速度

原则setSlices的值与索引的分片数相同时,迁移效率最高。

//提交请求响应
BulkByScrollResponse response=builder.get();

等待数据迁移完成即可。

相关文章:

  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-09
  • 2022-12-23
猜你喜欢
  • 2021-12-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-27
  • 2022-12-23
  • 2022-01-10
  • 2021-11-29
相关资源
相似解决方案