该博客介绍了如何在 Elasticsearch 中进行数据迁移,包括获取旧索引结构、创建新索引、配置安全设置(如跨域访问)以及使用 Reindex API 迁移数据的过程。这有助于确保在不中断服务的情况下更新或优化索引结构。
举例子:索引A为旧索引,索引B为新索引。
1、获取A索引(旧索引)的数据结构
GET /index_a/_mapping/
2、创建一个新的索引B,结构同A。
POST /index_b/_mapping/{"properties":{"age":{"type":"long"},"education":{"type":"text"},"other":{"type":"text"},"name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":256}}},"testedu":{"type":"text"}}}