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

编程入门 行业动态 更新时间:2024-10-16 00:21:03
本文介绍了在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?

推荐答案

Perl 和 Ruby 客户端直接支持重新索引。

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' );

在 Clinton Gormley的帖子。

在Ruby中,你'd do:

In Ruby, you'd do:

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

在相关轮胎提交。

更多推荐

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

本文发布于:2023-11-28 16:15:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643088.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:索引   碎片   ElasticSearch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!