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?
Asked
Active
Viewed 4,253 times
1 Answers
7
Both the Perl and Ruby clients directly support reindexing.
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'
);
Find more information in the post by Clinton Gormley.
In Ruby, you'd do:
Tire.index('old').reindex 'new', settings: { number_of_shards: 3 }
Find more information in the relevant Tire commit.

karmi
- 14,059
- 3
- 33
- 41
-
+1 for the answer and the excellent work ;) I'll add that the other alternative is to reindex from the contents of your database. This is also not uncommon if you are changing the contents of your index, say by adding a new field to be indexed. – Nick Zadrozny Mar 30 '12 at 23:08
-
Is there a way to do it from python? – eran Mar 24 '13 at 22:27