2017-05-25 28 views
1

有了這個映射:更新映射的屬性在現有的指數

curl -XPUT 'http://myip:9200/test?pretty' -d' 
{ 
    "mappings": { 
     "items": { 
      "dynamic": "strict", 
      "properties" : { 
       "title" : { "type": "string" }, 
       "body" : { "type": "string" }, 
       "publish_up" : { "type": "date", 
           "format" : "yyyy-MM-dd HH:mm:ss", 
           "copy_to": "publication_date"}, 
       "publication_date" : { "type": "date", 
             "format" : "yyyy-MM-dd HH:mm:ss"}, 

     }}}}' 

我想以此來回報值using fields財產publication_date更改爲"store" : "yes"。這是我的嘗試:

curl -X PUT 'http://myip:9200/test/_mapping/items?ignore_conflicts=true' -d '{ 
    "items": { 
    "properties": { 
     "publication_date": { 
     "type": "date", 
     "format" : "yyyy-MM-dd HH:mm:ss", 
     "store" : "yes" 
}}}}' 

但我得到的錯誤

{ 「錯誤」:{ 「ROOT_CAUSE」:[{ 「類型」: 「illegal_argument_exception」, 「原因」:「映射 對於[publication_date]與其他 類型中的現有映射衝突:\ n [mapper [publication_date]具有不同的[store] values]「}],」type「:」illegal_argument_exception「,」reason「:」Mapper for [publication_date ]與其他 類型中的現有映射衝突:\ n [mapper [publication_date]有不同的[store] values]「},」status「:400}

任何幫助?提前致謝。

PS:我正在使用ES 2.3

回答

1

將文檔寫入ES(高於ES 2版本)時,無法更新映射。

由於更改映射將意味着已經索引的文檔無效,因此您需要使用正確的映射創建新索引並將數據重新索引到該索引中。

1

您無法更改彈性映射。 Afaik你必須用新的映射重新索引你的數據。