2017-03-21 26 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
数据