码迷,mamicode.com
首页 > 其他好文 > 详细

[elasticsearch]ES迁移笔记

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

标签:分词器   term   for   索引   匹配   order   node.js   title   bool   

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迁移笔记

标签:分词器   term   for   索引   匹配   order   node.js   title   bool   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!