Update dynamically set mapping using PUT mapping API

Hey everyone ,
I have stucked over an issue.
I have an index with the following mapping currently :

"mappings": {
"product": {
"dynamic_templates": [
{
"template_name": {
"mapping": {
"type": "string",
"index": "analyzed",
"fields": {
"org": {
"type": "string",
"index": "not_analyzed"
}
},
"index_analyzer": "indexAnalyzer",
"search_analyzer": "standard"
},
"match": "*",
"match_mapping_type": "string"
}
}
]
}
}

Now i want to change the analyzer keeping all the other mapping same
.....i.e. i want to apply same dynamic mapping with diffrent
"index_analyzer". i have change settings to define new analyzer , but when
i PUT mapping i got error.

My command for mapping update is :
PUT epikkoproduct/product/_mapping
{
"properties": {
"dynamic_templates": [
{
"template_name1": {
"match": "*",
"match_mapping_type": "string",
"mapping": {

                    "type":"string",
                    "index": "analyzed",
                    "fields": {
                       "org": {
                          "type": "string",
                          "index": "not_analyzed"
                       }
                    },
                    "index_analyzer" :"newindexanalyzer"
                    "search_analyzer" :"standard"
                 }
                
              }
           }
        ]

}
}

this shows following error :

{
"error": "MapperParsingException[Expected map for property [fields] on
field [dynamic_templates] but got a class java.lang.String]",
"status": 400
}

Suggest any solutions ASAP

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c22d5fe2-de57-45c1-b394-3431680827f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Where you able to fix this error ?

1 Like