恢复Elasticsearch中的特定索引

时间:2018-06-25 17:31:17

标签: linux elasticsearch

我有2个Elasticsearch(1个用于PROD,1个用于DEV环境) 并且我已经设置了一个NFS分区(存储库),用于通过bash脚本从PROD备份所有索引。 并且我们在DEV Elasticsearch上具有相同的索引,但其中包含不同的数据。今天的开发人员表示,他想要从PROD到DEV的2个索引的完整副本。我已经有完整的索引备份! 我知道如何还原所有索引,但是如何选择仅有的两个索引?不是完全还原索引? 例如,我有包含此人的快照

{
   "snapshot":"elasticsearch_all_indicies_25_06_2018",
   "uuid":"aGzmhyOkmlkfmflnslndfs",
   "version_id":5060699,
   "version":"5.6.6",
   "indices":[
      "banners",
      "products",
      "catalogs",
      "darbiz",
      ".kibana",
      "invoices",
      "bundles",
      "groups",
      "searchitems",
      "params",
      "orders"
   ],
   "state":"SUCCESS",
   "start_time":"2018-06-24T23:30:01.978Z",
   "start_time_in_millis":1529883001978,
   "end_time":"2018-06-24T23:30:06.765Z",
   "end_time_in_millis":1529883006765,
   "duration_in_millis":4787,
   "failures":[

   ],
   "shards":{
      "total":75,
      "failed":0,
      "successful":75
   }
}

例如,我只需要将订单和参数索引而不是整个集合还原到DEV,我该怎么做?谢谢

1 个答案:

答案 0 :(得分:0)

您可以在发送到REST API的JSON内容的正文中指定要还原的索引。例如:

POST /_snapshot/my_backup/snapshot_1/_restore
{
  "indices": "order,params",
  "ignore_unavailable": true,
  "include_global_state": true
}

参考

https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_restore