reindex_upgrade.asciidoc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. [[reindex-upgrade]]
  2. === Reindex to upgrade
  3. Elasticsearch is able to use indices created in the previous major version
  4. only. For instance, Elasticsearch 6.x can use indices created in
  5. Elasticsearch 5.x, but not those created in Elasticsearch 2.x or before.
  6. NOTE: Elasticsearch 6.x nodes will fail to start in the presence of too old indices.
  7. If you are running an Elasticsearch 5.x cluster which contains indices that
  8. were created before 5.x, you will either need to delete those old indices or
  9. to reindex them before upgrading to 6.x. See <<reindex-upgrade-inplace>>.
  10. If you are running an Elasticsearch 2.x cluster or older, you have two options:
  11. * First upgrade to Elasticsearch 5.x, reindex the old indices, then upgrade
  12. to 6.x. See <<reindex-upgrade-inplace>>.
  13. * Create a new 6.x cluster and use reindex-from-remote to import indices
  14. directly from the 2.x cluster. See <<reindex-upgrade-remote>>.
  15. .Time-based indices and retention periods
  16. *******************************************
  17. For many use cases with time-based indices, you will not need to worry about
  18. carrying old 2.x indices with you to 6.x. Data in time-based indices usually
  19. becomes less interesting as time passes. Old indices can be deleted once they
  20. fall outside of your retention period.
  21. Users in this position can continue to use 5.x until all old 2.x indices have
  22. been deleted, then upgrade to 6.x directly.
  23. *******************************************
  24. [[reindex-upgrade-inplace]]
  25. ==== Reindex in place
  26. If you are running a 5.x cluster which contains indices created in
  27. Elasticsearch 2.x, you will need to reindex (or delete) those indices before
  28. upgrading to Elasticsearch 6.x.
  29. The reindex process works as follows:
  30. * Create a new index, copying the mappings and settings from the old index.
  31. Set the `refresh_interval` to `-1` and the `number_of_replicas` to `0` for
  32. efficient reindexing.
  33. * Reindex all documents from the old index to the new index using the
  34. <<docs-reindex,reindex API>>.
  35. * Reset the `refresh_interval` and `number_of_replicas` to the values
  36. used in the old index, and wait for the index to become green.
  37. * In a single <<indices-aliases,update aliases>> request:
  38. * Delete the old index.
  39. * Add an alias with the old index name to the new index.
  40. * Add any aliases that existed on the old index to the new index.
  41. At the end of this process, you will have a new 5.x index which can be used
  42. by an Elasticsearch 6.x cluster.
  43. [[reindex-upgrade-remote]]
  44. ==== Upgrading with reindex-from-remote
  45. If you are running a 1.x or 2.x cluster and would like to migrate directly to 6.x
  46. without first migrating to 5.x, you can do so using
  47. <<reindex-from-remote,reindex-from-remote>>.
  48. [WARNING]
  49. =============================================
  50. Elasticsearch includes backwards compatibility code that allows indices from
  51. the previous major version to be upgraded to the current major version. By
  52. moving directly from Elasticsearch 2.x or before to 6.x, you will have to solve any
  53. backwards compatibility issues yourself.
  54. =============================================
  55. You will need to set up a 6.x cluster alongside your existing old cluster.
  56. The 6.x cluster needs to have access to the REST API of the old cluster.
  57. For each old index that you want to transfer to the 6.x cluster, you will need
  58. to:
  59. * Create a new index in 6.x with the appropriate mappings and settings. Set
  60. the `refresh_interval` to `-1` and set `number_of_replicas` to `0` for
  61. faster reindexing.
  62. * Use <<reindex-from-remote,reindex-from-remote>> to pull documents from the
  63. old index into the new 6.x index.
  64. * If you run the reindex job in the background (with `wait_for_completion` set
  65. to `false`), the reindex request will return a `task_id` which can be used to
  66. monitor progress of the reindex job in the <<tasks,task API>>:
  67. `GET _tasks/TASK_ID`.
  68. * Once reindex has completed, set the `refresh_interval` and
  69. `number_of_replicas` to the desired values (the defaults are `30s` and `1`
  70. respectively).
  71. * Once the new index has finished replication, you can delete the old index.
  72. The 6.x cluster can start out small, and you can gradually move nodes from the
  73. old cluster to the 6.x cluster as you migrate indices across.