小编典典

重新索引ElasticSearch中的索引以更改分片数

elasticsearch

我需要更改索引中的分片数量。索引很大,为了达到测试目的,我可能不得不将配置更改10-15次才能满意。是否有开箱即用的工具提供这种功能?或最简单的方法是做到这一点?


阅读 1084

收藏
2020-06-22

共1个答案

小编典典

无论是Perl的Ruby客户直接支持重建索引。

在Perl中,您可以执行以下操作:

my $source = $es->scrolled_search(
    index       => 'old_index',
    search_type => 'scan',
    scroll      => '5m',
    version     => 1
);

$es->reindex(
    source      => $source,
    dest_index  => 'new_index'
);

Clinton
Gormley
帖子中查找更多信息。

在Ruby中,您可以执行以下操作:

Tire.index('old').reindex 'new', settings: { number_of_shards: 3 }

相关的 Tyre 提交中找到更多信息。

2020-06-22