在ElasticSearch中重新索引索引以更改碎片数 [英] Re-indexing an index in ElasticSearch to change the number of shards
本文介绍了在ElasticSearch中重新索引索引以更改碎片数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要更改索引中的碎片数。该索引相当大,我可能必须在配置10-15次之前进行测试,以便我对结果感到满意。有没有一个工具提供开箱即用的这种功能?或者是最简单的方式来实现这一点?
I need to change the number of shards in my index. The index is quite big and i may have to change the configuration 10-15 times for testing purposes before i'm satisfied with the result. is there a tool offering out of the box this kind of functionality? or what's the easiest way of accomplishing this?
推荐答案
Both the Perl and Ruby clients directly support reindexing.
在Perl中,您可以:
In Perl, you'd do:
my $source = $es->scrolled_search(
index => 'old_index',
search_type => 'scan',
scroll => '5m',
version => 1
);
$es->reindex(
source => $source,
dest_index => 'new_index'
);
在Ruby中,你'd do:
In Ruby, you'd do:
Tire.index('old').reindex 'new', settings: { number_of_shards: 3 }
在相关轮胎提交。
这篇关于在ElasticSearch中重新索引索引以更改碎片数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文