ES 索引迁移

创建了一个名为new_index的新Elasticsearch索引,设置了分片和副本数量,最大结果窗口及刷新间隔。定义了自定义分析器,包含停用词过滤。接着为new_index添加了映射,包括id和groupKey字段。最后,使用_reindexAPI从old_index迁移数据到new_index,每次迁移2000条记录。
摘要由CSDN通过智能技术生成

创建新索引

PUT new_index
{
  "settings": {
        "index": {
            "number_of_shards": "1",
            "number_of_replicas": "0",
            "max_result_window": "2000000000",
            "refresh_interval": -1
        },
        "analysis": {
            "filter": {
                "ll_stopwords": {
                    "type": "stop",
                    "stopwords": [
                        "有限",
                        "责任",
                        "公司",
                        "(",
                        ")",
                        "(",
                        ")"
                    ]
                }
            },
            "analyzer": {
                "index_analyzer": {
                    "type": "custom",
                    "tokenizer": "ik_max_word",
                    "filter": [
                        "ll_stopwords"
                    ]
                }
            }
        }
    } 
}

添加Mapping

PUT new_index/_mapping
{

    "properties": {
      "id": {
      "type": "keyword"
    },
    "groupKey": {
      "type": "keyword",
      "eager_global_ordinals": true
    },
    // ....
 }
}

迁移数据


POST _reindex
{
  "source": {
    "index": "old_index",
    "size":2000 
   },
  "dest": {
    "index": "new_index"
  }
}
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值