绊脚石乃是进身之阶。

es5.2 rollover的问题

Elasticsearch | 作者 code4j | 发布于2019年03月23日 | 阅读数:2030

今天在5.2版本的集群测试rollover功能,索引template:
{
"order": 0,
"template": "access-logs-*",
"settings": {
"index": {
"number_of_shards": "2",
"number_of_replicas": "1",
"routing": {
"allocation": {
"include": {
"_ip": "x.x.x.x,x.x.x.x"
},
"total_shards_per_node": "2"
}
}
}
},
"mappings": {},
"aliases": {
"access-logs": {},
"search-logs": {}
}
}

创建索引,写入三个文档,然后执行rollover:
POST access-logs/_rollover
{
"conditions": {
"max_age": "7d",
"max_docs": 6
}
}
然后成功了?返回结果如下:
{
"old_index": "access-logs-000001",
"new_index": "access-logs-000002",
"rolled_over": true,
"dry_run": false,
"acknowledged": true,
"shards_acknowledged": true,
"conditions": {
"[max_docs: 6]": true,
"[max_age: 7d]": false
}
}

可是我明明只写入了三个文档,rollover的max_docs阈值是6就成功了,这个max_docs指的是主分片加副本的数量吗
已邀请:

rochy - rochy_he

赞同来自:

ES5.X 没有提及这个 ​max_docs,看你的描述应该是主副分片全部的 num 数
 
ES6.X 特别声明了 max_docs 不计算副本的数量

要回复问题请先登录注册