更新时间:2023-09-07 GMT+08:00

匹配索引同步

请求URL和请求体参数如下:

PUT auto_sync/pattern/{pattern_name}
表1 请求体参数说明

参数名

说明

remote_cluster

主集群名称,通过“配置主集群信息”设置,具体值如上文的leader1

remote_index_patterns

主集群待同步索引模式,支持通配符*

local_index_pattern

从集群同步索引模式,支持模板替换。如为{{remote_index}}-sync,待同步索引为log1,同步过来的索引为log1-sync

apply_exist_index

是否同步主集群上已存在的索引,默认为true

settings

同步索引的索引设置

以下给出三种使用示例

1. 将主集群的单个索引同步到从集群:

PUT auto_sync/pattern/pattern1
{
 "remote_cluster": "leader1",
 "remote_index_patterns": "log*",
 "local_index_pattern": "{{remote_index}}-sync",
 "apply_exist_index": true
}

2. 将主集群的单个索引同步到从集群,并修改部分索引配置:

PUT auto_sync/pattern/pattern1
{
 "remote_cluster": "leader1",
 "remote_index_patterns": "log*",
 "local_index_pattern": "{{remote_index}}-sync",
 "apply_exist_index": true,
 "settings": {
   "number_of_replicas": 4
 }
}

注意以下索引配置无法修改:

  • number_of_shards
  • version.created
  • uuid
  • creation_date
  • soft_deletes.enabled