恢复编辑

actions:
  1:
    action: restore
    description: >-
      Restore all indices in the most recent snapshot with state SUCCESS.  Wait
      for the restore to complete before continuing.  Do not skip the repository
      filesystem access check.  Use the other options to define the index/shard
      settings for the restore.
    options:
      repository:
      # If name is blank, the most recent snapshot by age will be selected
      name:
      # If indices is blank, all indices in the snapshot will be restored
      indices:
      wait_for_completion: True
      max_wait: 3600
      wait_interval: 10
    filters:
    - filtertype: state
      state: SUCCESS
      exclude:
    - filtertype: ...

空值和注释行将导致选择默认值(如果有)。如果设置了某个设置,但未在给定操作中使用,则会忽略该设置。

此操作将从指定的 存储库 恢复索引,从应用过滤器标识的最新快照恢复,或从 名称 标识的快照恢复。

恢复时重命名索引编辑

您可以使用 重命名模式重命名替换 选项在恢复时重命名索引。

actions:
  1:
    action: restore
    description: >-
      Restore all indices in the most recent snapshot with state SUCCESS.  Wait
      for the restore to complete before continuing.  Do not skip the repository
      filesystem access check.  Use the other options to define the index/shard
      settings for the restore.
    options:
      repository:
      # If name is blank, the most recent snapshot by age will be selected
      name:
      # If indices is blank, all indices in the snapshot will be restored
      indices:
      rename_pattern: 'index(.+)'
      rename_replacement: 'restored_index$1'
      wait_for_completion: True
      max_wait: 3600
      wait_interval: 10
    filters:
    - filtertype: state
      state: SUCCESS
      exclude:
    - filtertype: ...

在此配置中,Elasticsearch 将捕获 index 之后出现的任何内容,并将其放在 restored_index 之后。例如,如果我恢复的是 index-2017.03.01,则结果索引将被重命名为 restored_index-2017.03.01

额外设置编辑

额外设置 选项允许添加额外设置,例如索引设置。以下是如何使用这些设置更改要恢复的索引设置的示例:

actions:
  1:
    action: restore
    description: >-
      Restore all indices in the most recent snapshot with state SUCCESS.  Wait
      for the restore to complete before continuing.  Do not skip the repository
      filesystem access check.  Use the other options to define the index/shard
      settings for the restore.
    options:
      repository:
      # If name is blank, the most recent snapshot by age will be selected
      name:
      # If indices is blank, all indices in the snapshot will be restored
      indices:
      extra_settings:
        index_settings:
          number_of_replicas: 0
      wait_for_completion: True
      max_wait: 3600
      wait_interval: 10
    filters:
    - filtertype: state
      state: SUCCESS
      exclude:
    - filtertype: ...

在这种情况下,副本数量将应用于恢复的索引。

有关更多信息,请参阅 官方 Elasticsearch 文档

必需设置编辑