Elasticsearch快照

时间:2014-09-30 19:41:56

标签: elasticsearch

如果elasticsearch快照包含多个索引(例如:wikipedia,ehow,howStaffWorks),我们是否可以只将其中一个索引加载到elasticsearch服务器中,或者在加载快照时是否必须加载所有索引?

3 个答案:

答案 0 :(得分:4)

elasticsearch网站上的documentation显示从快照恢复特定索引:

curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
 "indices": "index_1,index_2",
 "ignore_unavailable": "true",
 "include_global_state": false,
 "rename_pattern": "index_(.+)",
 "rename_replacement": "restored_index_$1"
}'

请参阅上面的indices

答案 1 :(得分:0)

是的,你可以。无需加载所有索引。

curl -XPOST "localhost:9200/_snapshot/my_backup/snapshot_1/_restore" -d '{
  "indices": "index_1",
  "ignore_unavailable": "true",
  "include_global_state": false,
  "rename_pattern": "index_(.+)",
  "rename_replacement": "restored_index_$1"
}'

要加载所有索引,您可以使用以下代码,(感知插件)

PUT  /_snapshot/my_backup/snapshot_1?wait_for_completion=true

答案 2 :(得分:0)

是的,我们可以加载。

$ curl -XPUT 'http://localhost:9200/twitter/' -d '
        "index" : {
            "number_of_shards" : 3, 
            "number_of_replicas" : 2