美文网首页
ES索引迁移

ES索引迁移

作者: ________方块丶 | 来源:发表于2021-08-08 20:12 被阅读0次

    再对索引的分片数量或者是字段分词器进行调整时,需要对索引进行重建迁移,对应操作API为reindex

    创建索引

    PUT performance_order_tmp
    {
        "settings" : {
            "index" : {
                "number_of_shards" : 32, 
                "number_of_replicas" : 1
            }
        }
    }
    

    创建Mapping mapping中给字段指定分词器

    PUT performance_order_tmp/_mapping
    {
           "properties": {
            "actual_end_date": {
              "type": "date",
              "format": "yyyy-MM-dd"
            },
            "address": {
              "type": "text",
              "analyzer": "ik_max_word"
            }
          }
    
    }
    

    index 迁移

    POST _reindex
    {
      "source": {
        "index": "performance_order"
      },
      "dest": {
        "index": "performance_order_tmp"
      }
    }
    

    相关文章

      网友评论

          本文标题:ES索引迁移

          本文链接:https://www.haomeiwen.com/subject/ecgovltx.html