2017-03-21 28 views
0

當我想改變文本字段的類型與此COMMANDE以關鍵字:遷移字段類型對ElasticsearchEDIT關鍵字:

PUT indexStat/_mapping/StatCateg 
{ 
    "StatCateg":{ 
    "properties": { 
     "nom_categorie": { 
     "type":"keyword","index": true 
     } 
    } 
    } 
} 

我有這樣的消息:

{ 
    "error": { 
    "root_cause": [ 
     { 
     "type": "illegal_argument_exception", 
     "reason": "mapper [nom_categorie] of different type, current_type [text], merged_type [keyword]" 
     } 
    ], 
    "type": "illegal_argument_exception", 
    "reason": "mapper [nom_categorie] of different type, current_type [text], merged_type [keyword]" 
    }, 
    "status": 400 
} 

回答

2

OK最後,我在文檔中看到,無法更改字段的數據類型:

更新現有映射

除了有記錄的地方外,現有的類型和字段映射不能更新爲 。更改映射將意味着已經索引的文檔已經失效。相反,您應該使用正確的映射創建一個新的索引,並將您的數據重新索引到該索引。

因此,唯一的解決辦法是:

  • 重建具有良好的數據類型的新指標
  • 重新編制與重新編制API
數據