Skip to content

Commit 95ce232

Browse files
committed
Docs: Advice for reindexing many indices (#31279)
Folks tend to want to be able to make a single `_reindex` call to migrate many indices. You *can* do that and we even have an example of how to do that in the docs but it isn't always a good idea. This change adds some advice to the docs: generally you want to make one reindex call per index. Closes #22920
1 parent 70c14a5 commit 95ce232

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

docs/reference/docs/reindex.asciidoc

+29-2
Original file line numberDiff line numberDiff line change
@@ -1028,11 +1028,38 @@ number of slices.
10281028
Whether query or indexing performance dominates the runtime depends on the
10291029
documents being reindexed and cluster resources.
10301030

1031+
[float]
1032+
=== Reindexing many indices
1033+
If you have many indices to reindex it is generally better to reindex them
1034+
one at a time rather than using a glob pattern to pick up many indices. That
1035+
way you can resume the process if there are any errors by removing the
1036+
partially completed index and starting over at that index. It also makes
1037+
parallelizing the process fairly simple: split the list of indices to reindex
1038+
and run each list in parallel.
1039+
1040+
One off bash scripts seem to work nicely for this:
1041+
1042+
[source,bash]
1043+
----------------------------------------------------------------
1044+
for index in i1 i2 i3 i4 i5; do
1045+
curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
1046+
"source": {
1047+
"index": "'$index'"
1048+
},
1049+
"dest": {
1050+
"index": "'$index'-reindexed"
1051+
}
1052+
}'
1053+
done
1054+
----------------------------------------------------------------
1055+
// NOTCONSOLE
1056+
10311057
[float]
10321058
=== Reindex daily indices
10331059

1034-
You can use `_reindex` in combination with <<modules-scripting-painless, Painless>>
1035-
to reindex daily indices to apply a new template to the existing documents.
1060+
Notwithstanding the above advice, you can use `_reindex` in combination with
1061+
<<modules-scripting-painless, Painless>> to reindex daily indices to apply
1062+
a new template to the existing documents.
10361063

10371064
Assuming you have indices consisting of documents as follows:
10381065

0 commit comments

Comments
 (0)