簡體   English   中英

更改Elasticsearch版本

[英]Change Elasticsearch versioning

好吧,說我有一個很少更新的elasticsearch索引。 每次更新時,我都需要更改它的版本。

例如:首先我創建索引

PUT /test_index
{
    "settings": {
        "number_of_shards": 3,
        "number_of_replicas": 1 },
    "mappings": {
        "student_data": {
            "properties": {
                "name": {"type": "keyword" },
                "grade": { "type": "float" },
                "created_date": { "type": "float"}
            }
        }
    }
}

創建創建的索引設置后,我得到

"settings": {
    "index": {
        "creation_date": "1549622658089",
        "number_of_shards": "3",
        "number_of_replicas": "1",
        "uuid": "xxxxxxxxx",
        "version": {
        "created": "6050199"
    },
    "provided_name": "test_index"
    }

我需要改變這個

"version": {"created": "6050199"}

每次我更新索引中的文檔。 有沒有辦法做到這一點? 先感謝您。

僅供參考:我嘗試在創建索引時添加版本,例如

PUT /test_index
{
    "settings": {
        "number_of_shards": 3,
        "number_of_replicas": 1,
        "version": 2
    },
    "mappings": {
        "student_data": {
            "properties": {
                "name": {"type": "keyword"},
                "grade": {"type": "float"},
                "created_date": {"type": "float"}
            }
        }
    }
}

但是我得到了錯誤

{“錯誤”:{“ root_cause”:[{“ type”:“ illegal_argument_exception”,“ reason”:“未知設置[index.version],請檢查是否已安裝所有必需的插件,或查看重大更改文檔中已刪除的設置“}],” type“:” illegal_argument_exception“,”原因“:”未知設置[index.version]請檢查是否已安裝所有必需的插件,或查看重大更改文檔以了解已刪除的設置“},”狀態“:400 }

創建的版本是指創建索引的elasticsearch版本。 您不能像那樣更改它,也沒有理由這樣做。

如果您升級彈性搜索版本,請使用新版本重新索引索引,新版本也會被更新。

編輯:如果要在索引類型級別使用自定義字段,請使用元字段: https : //www.elastic.co/guide/zh-CN/elasticsearch/reference/current/mapping-meta-field.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM