Tìm hiểu sâu về API _reindex trong Elasticsearch
1. Cấu Trúc Cơ Bản Của API _Reindex
POST _reindex
{
"source": {
"index": "source_index", // Tên index nguồn
"query": { // (Tùy chọn) Truy vấn lọc dữ liệu từ index nguồn
"match_all": {}
},
"size": 1000 // (Tùy chọn) Số lượng tài liệu lấy trong mỗi lần truy vấn
},
"dest": {
"index": "destination_index", // Tên index đích
"op_type": "index" // Phương thức ghi tài liệu vào index đích (mặc định là "index")
}
}2. Các Tùy Chọn Chính Trong API _Reindex
2.1 op_type
op_type2.2 size
size2.3 script
script2.4 conflicts
conflicts2.5 wait_for_completion
wait_for_completion2.6 scroll
scroll2.7 routing
routing3. Các Tình Huống Sử Dụng API _Reindex
3.1 Di Chuyển Dữ Liệu Giữa Các Index
3.2 Di Chuyển Dữ Liệu Với Điều Kiện Lọc
3.3 Chỉnh Sửa Dữ Liệu Trong Quá Trình Reindex
3.4 Reindex Với Điều Kiện Xung Đột
4. Tổng Kết
Last updated