标签:
最近在接手elasticsearch 方面的工作,其中向已有的mapping添加新的字段的时候,一开始在网上找 资料,发现 网上 的资料都是关于更新mapping中已有字段类型的,所以写 一篇关于向 已有mapping添加新 字段的文章,仅供elasticsearch的新手学习。
curl -XPUT http://localhost:9200/test/regist/_mapping -d ‘
{
    "properties": {
        "user_id": {
            "type": "string", 
            "index": "not_analyzed"
        }, 
        "thks_id": {
            "type": "string", 
            "index": "not_analyzed"
        }, 
        "retype": {
            "type": "string", 
            "index": "not_analyzed"
        }
    }
}
‘
这段代码的意思是向test这个mapping中type 为regist,添加user_id、thks_id、retype三个新字段。执行之后,在elasticsearch的插件中可以看到test这个mapping中已经追加了这三个字段。
标签:
原文地址:http://www.cnblogs.com/aigeruinaier/p/5103365.html