首页 > 其他 > 详细

[elasticsearch]ES迁移笔记

时间:2018-03-06 10:10:36      阅读:227      评论:0      收藏:0      [点我收藏+]

ES在更改分词器或更改已有mapping结构后需要重新重新索引,当然复制也是一样的,相当于重新生成索引信息

//es的head插件地址:http://localhost:9200/_plugin/head/

//新建索引
PUT    /my_index_new
{//此处mapping复制的时候可以复制已有的mapping信息
  "mappings": {
    "my_type" : {
      "properties": {
        "title" : {
          "type": "string"
        }
      }
    }
  }
}
//移动数据,重新索引
_reindex
{
  "source": {
    "index": "rdx_dnax_formal"
  },
  "dest": {
    "index": "rdx_dnax_test",
    "op_type": "create"
  }
}

//elasticsearch 远程迁移数据,可以使用node.js的reindex插件

elasticsearch-reindex  -f  http://10.0.0.212:9200/rdx_dnax_formal/rdx_type  -t  http://es.dnax.iol8.com:9200/rdx_dnax_formal/rdx_type (如果报超时,可能就是reindex的配置超时时间需要设置调整)

当然可以在建索引的时候就建立镜像库方便后期迁移

 //es查找

{"query":{"bool":{"filter":{"and":[{"and":[{"term":{"zy_laiyuan":"PE-APP"}}]}]},"minimum_should_match":"100%"}},"sort":{[{"zy_hzcishu":{"order":"asc","mode":"max"}}]}}

match_phrase(短语匹配)

[elasticsearch]ES迁移笔记

原文:https://www.cnblogs.com/hhao321/p/8512350.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!