Skip to content

Commit

Permalink
Docs: Advice for reindexing many indices (#31279)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nik9000 committed Jun 19, 2018
1 parent a4c9ebc commit aa13165
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions docs/reference/docs/reindex.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -1025,11 +1025,38 @@ number of slices.
Whether query or indexing performance dominates the runtime depends on the
documents being reindexed and cluster resources.

[float]
=== Reindexing many indices
If you have many indices to reindex it is generally better to reindex them
one at a time rather than using a glob pattern to pick up many indices. That
way you can resume the process if there are any errors by removing the
partially completed index and starting over at that index. It also makes
parallelizing the process fairly simple: split the list of indices to reindex
and run each list in parallel.

One off bash scripts seem to work nicely for this:

[source,bash]
----------------------------------------------------------------
for index in i1 i2 i3 i4 i5; do
curl -HContent-Type:application/json -XPOST localhost:9200/_reindex?pretty -d'{
"source": {
"index": "'$index'"
},
"dest": {
"index": "'$index'-reindexed"
}
}'
done
----------------------------------------------------------------
// NOTCONSOLE

[float]
=== Reindex daily indices

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

Assuming you have indices consisting of documents as follows:

Expand Down

0 comments on commit aa13165

Please sign in to comment.