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(短语匹配)
来源: http://www.bubuko.com/infodetail-2517032.html