1,条件:
目标索引不能是已存在的
目标索引的分片数是源索引的一个因子
当目标索引的分片数是1时,源所以的文档数不能超过21亿
收缩之前必须设置源索引的所有分片都在同一个节点上,并且是只读的。
{
"settings": {
"index.routing.allocation.require._name": "v2test_prdNode1",
"index.blocks.write": true
}
}
2,put http://127.0.0.1:9200/v2aaa/_shrink/new_index_target
{
"settings": {
"index": {
"number_of_shards": "1",
"number_of_replicas":0
},
"index.routing.allocation.require._name": null,
"index.blocks.write": null
}
}
ES索引收缩成功!