简体   繁体   中英

Snapshot for certain index in elasticsearch?

I am new to elasticsearch. I'm trying to create a snapshot for backup in elasticsearch, but I don't want to snapshot the whole cluster. I'm still getting used to the terms here so I might have addressed something wrong, but the idea is basically:

localhost:9200
|
|--index_1
      |
      |---type 1
             |---log_1
             |---log_2
      |---type 2
|--index_2
      |
      |---type 1
      |---type 2

Currently,

  • I can successfully create snapshot for index_1 and index_2 ,
  • so localhost:9200/_snapshot/index_1 shows the setting, type 1 .

Is there a way to do it?

From the description above 1.1 isn't an index, its a document type inside an index.

The index is index_1. Inside it there are documents of 2 different types, which can be queried separately.

I don't believe you can dump a document type from inside an index without some custom scripting.

If you decide to build a script you might want to look at https://github.com/taskrabbit/elasticsearch-dump . It might be easy to modify for your needs.

Not only can you select particular indexes for backup, but it can dump it in json format so it can be imported to other versions of ElasticSearch, provided the mappings are still valid in the new version.

Yes, you can. You do not need to take snapshot of whole cluster. For taking snapshot of individual index you can follow below code:

       PUT /_snapshot/my_backup/snapshot_1
             {
         "indices": "index_1",
         "ignore_unavailable": "true",
         "include_global_state": false
              } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM