ES 索引迁移

  • Post author:
  • Post category:其他


创建新索引

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"
  }
}
 



版权声明:本文为istruth原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。