1.设置索引t2为想要的数据类型

2.将t1 reindex到t2

3.数据reindex完成删除t1

4.设置索引t1为想要的数据类型

5.将t2 reindex到t1

如果 _reindex 超时 返回504等

通过语句可以看到任务还在进行, 数据还在迁移中
GET _tasks?actions=*reindex&detailed
PUT t1
{
"settings": {
"index": {
"number_of_shards": "2",
"analysis": {
"analyzer": {
"ik_custom_analyzer": {
"filter": [
"lowercase"
],
"type": "custom",
"tokenizer": "ik_max_word"
}
}
},
"number_of_replicas": "1"
}
},
"mappings": {
"doc": {
"properties": {
"abs_path": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"comp_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"id_path": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"index_update_time": {
"type": "long"
},
"name": {
"type": "text",
"analyzer": "ik_custom_analyzer"
},
"parent_id": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
"star": {
"type": "long"
},
"time": {
"type": "long"
},
"weight": {
"type": "long"
}
}
}
}
} PUT /t2
{ "settings": {
"number_of_shards": 2,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"simplechar_index_analyzer": {
"type": "custom",
"tokenizer": "simplechar_index"
},
"simplechar_search_analyzer": {
"type": "custom",
"tokenizer": "simplechar_search"
},
"pinyin_index_analyzer": {
"type": "custom",
"tokenizer": "pinyin_index"
},
"pinyin_search_analyzer": {
"type": "custom",
"tokenizer": "pinyin_search"
}
},
"tokenizer": {
"simplechar_index": {
"type": "simplechar_and_pinyin",
"simple_char": true,
"prefix_en": true,
"prefix_num": true
},
"simplechar_search": {
"type": "simplechar_and_pinyin",
"simple_char": true,
"prefix_num": true,
"prefix_en": true
},
"pinyin_index": {
"type": "simplechar_and_pinyin",
"simple_char": true,
"han_to_pinyin": true,
"keep_first": true,
"keep_fuzzy": true,
"simple_num": true
},
"pinyin_search": {
"type": "simplechar_and_pinyin",
"simple_char": true,
"en_to_pinyin": true,
"simple_num": true
}
}
}
},
"mappings": {
"doc": {
"properties": {
"name": {
"type": "text",
"analyzer": "simplechar_index_analyzer",
"search_analyzer": "simplechar_search_analyzer",
"similarity": "boolean",
"fielddata": true,
"fields": {
"pinyin": {
"type": "text",
"similarity": "boolean",
"analyzer": "pinyin_index_analyzer",
"search_analyzer": "pinyin_search_analyzer",
"fielddata": true
}
}
}
}
}
}
} PUT t1/doc/3
{
"id": "3",
"name": "第七层",
"star": 0,
"parent_id": "134111385604698112",
"comp_id": "500000151",
"abs_path": "啤啤第三个公司/这个是子部门1/这个是部门下的部门/再加/第五层/第六层/第七层",
"id_path": "131773053453164544,131775211384823808,131775319170052096,132666474766233600,134111338699763712,134111385604698112,134112080391122944",
"weight": "2",
"index_update_time": 1547469387,
"time": 1547469386994201600
} GET t1/doc/_search
{
"size": 20,
"query": {
"match_all": {}
}
} 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"
}
}
GET t1/_mapping
GET t2/_mapping GET t2/doc/_search
{
"size": 20,
"query": {
"match_all": {}
}
}

最新文章

  1. javascript,从库到框架再到平台
  2. sql 知识点系统汇总
  3. vue.js2.0的独立构建和运行时构建
  4. 3d加速的一些问题
  5. Linux下删除空文件,删除指定大小的文件
  6. ASP.NET MVC路由配置(转载自http://www.cnblogs.com/zeusro/p/RouteConfig.html )
  7. 字符串复制strncpy
  8. Codeforces Round #182 (Div. 1)题解【ABCD】
  9. Telegram
  10. 如何调用super
  11. $watch How the $apply Runs a $digest
  12. jQuery网页元素拖拽插件
  13. 关于size_t与size_type
  14. SDUT 1646 Complicated Expressions
  15. Android 国际化图片资源文件
  16. 分享,iOS国家手机区号代码.plist
  17. [UWP]如何使用代码创建DataTemplate(或者ControlTemplate)
  18. $Django 路飞之小知识回顾,Vue之样式element-ui,Vue绑定图片--mounted页面挂载--路由携带参数
  19. 基于MSMQ绑定的WCF服务实现总结
  20. 基于TLS证书手动部署kubernetes集群(上)

热门文章

  1. 关于h5游戏开发,你想了解的一切都在这儿!
  2. seajs1.3.0源码解析之module依赖有序加载
  3. pytest allure 生成html测试报告
  4. python图片转码为base64
  5. vue-element-admin实战 | 第二篇: 最小改动接入后台实现根据权限动态加载菜单
  6. 聊聊分布式下的WebSocket解决方案
  7. 学会Git玩转GitHub(第一篇) 入门详解 - 精简归纳
  8. 几个超级好用但很少有人知道的 webstorm技巧
  9. LDA主题模型困惑度计算
  10. 破晓行动----带你总结JVM的知识大全(二)