kulssaka
kulssaka

Reputation: 226

Update mapping not working on my index (elasticsearch 1.4)

When I try to update my index, and add a new field created from the method copy_to (see http://pastebin.com/T7GcHSXj ), I get this error I don't understand:

"error":"MapperParsingException[Root type mapping not empty after parsing! Remaining fields: [mappings : {tInfoclient={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}}}}}}]]","status":400}

I followed documentation from the website, but no clue: 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

Upvotes: 1

Views: 221

Answers (1)

Val
Val

Reputation: 217254

When updating a mapping type you need to remove the mappings section and the type name since those are already specified in the 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"
                        }
                    }
                }
            }

}'

Upvotes: 1

Related Questions