ES 单索引大表拆分
使用reindex 命令进行拆分,具体流程如下:
//1.查询原表,拿到表结构 GET big_data/_search //3.调整刷新策略 PUT sm_data_1/_settings {"refresh_interval": "1s"} //5.同步数据 POST _reindex?wait_for_completion=false { "source": { "index": "big_data", "size": 50000, "query": { "term": { "month": { "value": "202212" } } } }, "dest": { "index": "sm_data_1" } }
//分片同步,分片5
POST _reindex?slices=5&refresh
"_source": {
"exclude": ["param"]
}
//6.查询同步任务 GET /_tasks?detailed=true&actions=*reindex