更新映射不适用于我的索引(elasticsearch 1.4)

时间:2016-10-28 14:40:29

标签: json elasticsearch put

当我尝试更新索引并添加从方法copy_to创建的新字段(请参阅http://pastebin.com/T7GcHSXj)时,我收到此错误,我不明白:

  

“error”:“MapperParsingException [根类型映射后不为空   解析!剩余字段:[映射:   {tInfoclient = {属性= {客户= {属性= {d_naiss_cli = {类型=串,   copy_to = full_info},pr_cli_20 = {type = string,copy_to = full_info},   nom_cli_20 = {type = string,copy_to = full_info},full_info = {type = string},   dc_cli = {format = dateOptionalTime,type = date},   no_coEmprunteur = {type = string},cmpl_voie_cli = {type = string},   loc_cli = {type = string},no_tel_cli = {type = string},   no_ctrat = {type = string},no_tel_empcli = {type = string},   voie_cli = {type = string},c_post_cli = {type = string},   c_qual = {type = string},ad_e_mail = {type = string},no_telp = {type = string},   ptel_empcli = {类型=串}}}}}}]]”, “状态”:400}

我关注了网站上的文档,但没有任何线索: https://www.elastic.co/guide/en/elasticsearch/reference/1.4/indices-put-mapping.html https://www.elastic.co/guide/en/elasticsearch/guide/1.x/custom-all.html

1 个答案:

答案 0 :(得分:1)

更新映射类型时,您需要删除mappings部分和类型名称,因为这些已在URL中指定:

curl -XPUT 'http://maprvm:9200/maprdb/_mapping/tInfoclient' -d '{
            "properties": {
                "Client": {
                    "properties": {
                        "d_naiss_cli": {
                            "type": "string",
                            "copy_to":  "full_info"
                        },
                        "pr_cli_20": {
                            "type": "string",
                            "copy_to":  "full_info"
                        },
                        "nom_cli_20": {
                            "type": "string",
                            "copy_to":  "full_info"
                        },
                        "full_info": {
                            "type":     "string"
                        },
                        "dc_cli": {
                            "format": "dateOptionalTime",
                            "type": "date"
                        },
                        "no_coEmprunteur": {
                            "type": "string"
                        },
                        "cmpl_voie_cli": {
                            "type": "string"
                        },
                        "loc_cli": {
                            "type": "string"
                        },
                        "no_tel_cli": {
                            "type": "string"
                        },
                        "no_ctrat": {
                            "type": "string"
                        },
                        "no_tel_empcli": {
                            "type": "string"
                        },
                        "voie_cli": {
                            "type": "string"
                        },
                        "c_post_cli": {
                            "type": "string"
                        },
                        "c_qual": {
                            "type": "string"
                        },
                        "ad_e_mail": {
                            "type": "string"
                        },
                        "no_telp": {
                            "type": "string"
                        },
                        "ptel_empcli": {
                            "type": "string"
                        }
                    }
                }
            }

}'