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

Yer*_*yan 4 indexing elasticsearch

我需要更改索引中的分片数量.索引非常大,在我对结果感到满意之前,为了测试目的,我可能需要更改配置10-15次.有没有开箱即用的工具这种功能?或者最简单的方法是什么?

kar*_*rmi 7

无论是Perl的红宝石客户直接支持重建索引.

在Perl中,你会这样做:

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

$es->reindex(
    source      => $source,
    dest_index  => 'new_index'
);
Run Code Online (Sandbox Code Playgroud)

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

在Ruby中,你会做:

Tire.index('old').reindex 'new', settings: { number_of_shards: 3 }
Run Code Online (Sandbox Code Playgroud)

相关的轮胎提交中查找更多信息.