es 迁移数据, 重建索引

原索引
PUT my_index
{
"mappings": {
"_doc": {
"properties": {
"create_date": {
"type": "date",
"format": "yyyy-MM-dd ||yyyy/MM/dd"
}
}
}
}
}
  二、创建新索引
PUT my_index2
{
"mappings": {
"_doc": {
"properties": {
"create_date": {
"type": "text"
}
}
}
}
}
  三、同步数据

POST _reindex
{
"source": {
"index": "my_index"
},
"dest": {
"index": "my_index2"
}
}
  四、删除原索引

DELETE my_index
  五、设置别名

POST /_aliases
{
"actions": [
{"add": {"index": "my_index2", "alias": "my_index"}}
]
}

#######
POST _reindex
{
"source": {
"index": "t1"
},
"dest": {
"index": "t2",
"version_type": "external"
},
"script": {
"source":"def w = ctx._source.remove('weight');ctx._source.weight=w;",
"lang": "painless"
}
}

上一篇:编写一个程序,将字符数组s2中的全部字符复制到字符数组s1中,不用strcpy函数。复制时,‘\0’也要赋值过去。'\0'之后的字符不复制


下一篇:还是广搜……wsl