Increasing the number of index shards

Is it possible to change the number of shards of existing indices? How to do this with Python?

You can change the number of replica shards, but not the number of primary shards. You can however use the split index API to create a new index with a different number of primary shards based on an existing index. If you have an alias in front of your index you can then reroute it after the split, but it requires you to stop indexing/updating/deleting traffic for a period of time.

1 Like

Hello @Christian_Dahlqvist , thank you for always helping me. I want to change the number of shards of each index to 100 if it is, for example, 50.

I assume we are talking about primary shards. What is driving this change?

To do that you will need to use the API I pointed to.

1 Like

Does that mean I have to use this API for each and every existing index?!


How many indices do you have that need to scale out?

What is the average size of these?

Why are you scaling out?

Be aware that having lots of small shards can be very inefficient and cause performance problems.

1 Like

This is just a task assigned to me and it is important to write the python code. I thought I could do it with a for loop:)

@Christian_Dahlqvist Can I use max_result _window for this?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.