简体   繁体   English

弹性搜索中某些索引的快照?

[英]Snapshot for certain index in elasticsearch?

I am new to elasticsearch. 我是Elasticsearch的新手。 I'm trying to create a snapshot for backup in elasticsearch, but I don't want to snapshot the whole cluster. 我正在尝试为Elasticsearch中的备份创建快照,但是我不想对整个集群进行快照。 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 , 我可以为index_1index_2成功创建快照,
  • so localhost:9200/_snapshot/index_1 shows the setting, type 1 . 因此localhost:9200/_snapshot/index_1显示设置, 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. 从上面的描述1.1并不是索引,它是索引内的文档类型。

The index is index_1. 索引是index_1。 Inside it there are documents of 2 different types, which can be queried separately. 里面有2种不同类型的文档,可以分别查询。

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 . 如果决定构建脚本,则可能需要查看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. 您不仅可以选择特定的索引进行备份,还可以以json格式转储它,以便可以将其导入到其他版本的ElasticSearch中,前提是该映射在新版本中仍然有效。

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
              } 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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