从一个索引中提取出部分数据到新的索引中
# reindex data by filter
# POST _reindex?wait_for_completion=false
{
"source": {
"index": "source_idx",
"size" : 10000,
"query": {
"bool": {
"filter": [
{
"range": {
"event_time": {
"gte": "2019-04-04||/M",
"lt": "2019-04-04"
}
}
}
]
}
}
},
"dest": {
"index": "dest_idx"
}
}
:::tips size表示ES一次重索引的文档数量(用的bulk接口) :::
reindex时使用pipeline
# POST _reindex?wait_for_completion=false
{
"source": {
"index": "source_idx",
"size" : 10000
},
"dest": {
"index": "dest_idx",
"pipeline": "monthlyindex"
}
}
建议看看reindex的官方文档