@@ -31,6 +31,8 @@ index may by split into an arbitrary number of shards greater than 1. The
31
31
properties of the default number of routing shards will then apply to the
32
32
newly split index.
33
33
34
+ [float]
35
+ === How does splitting work?
34
36
35
37
Splitting works as follows:
36
38
@@ -47,6 +49,36 @@ Splitting works as follows:
47
49
* Finally, it recovers the target index as though it were a closed index which
48
50
had just been re-opened.
49
51
52
+ [float]
53
+ === Why doesn't Elasticsearch support incremental resharding?
54
+
55
+ Going from `N` shards to `N+1` shards, aka. incremental resharding, is indeed a
56
+ feature that is supported by many key-value stores. Adding a new shard and
57
+ pushing new data to this new shard only is not an option: this would likely be
58
+ an indexing bottleneck, and figuring out which shard a document belongs to
59
+ given its `_id`, which is necessary for get, delete and update requests, would
60
+ become quite complex. This means that we need to rebalance existing data using
61
+ a different hashing scheme.
62
+
63
+ The most common way that key-value stores do this efficiently is by using
64
+ consistent hashing. Consistent hashing only requires `1/N`-th of the keys to
65
+ be relocated when growing the number of shards from `N` to `N+1`. However
66
+ Elasticsearch's unit of storage, shards, are Lucene indices. Because of their
67
+ search-oriented data structure, taking a significant portion of a Lucene index,
68
+ be it only 5% of documents, deleting them and indexing them on another shard
69
+ typically comes with a much higher cost than with a key-value store. This cost
70
+ is kept reasonable when growing the number of shards by a multiplicative factor
71
+ as described in the above section: this allows Elasticsearch to perform the
72
+ split locally, which in-turn allows to perform the split at the index level
73
+ rather than reindexing documents that need to move, as well as using hard links
74
+ for efficient file copying.
75
+
76
+ In the case of append-only data, it is possible to get more flexibility by
77
+ creating a new index and pushing new data to it, while adding an alias that
78
+ covers both the old and the new index for read operations. Assuming that the
79
+ old and new indices have respectively +M+ and +N+ shards, this has no overhead
80
+ compared to searching an index that would have +M+N+ shards.
81
+
50
82
[float]
51
83
=== Preparing an index for splitting
52
84
@@ -171,4 +203,4 @@ replicas and may decide to relocate the primary shard to another node.
171
203
172
204
Because the split operation creates a new index to split the shards to,
173
205
the <<create-index-wait-for-active-shards,wait for active shards>> setting
174
- on index creation applies to the split index action as well.
206
+ on index creation applies to the split index action as well.
0 commit comments