StrictDynamicMapping and MultiFields


(John O'Gara) #1

I'm having a problem with using strict dynamic mapping and multi-field
values. My multi fields work fine when I don't have StrictDynamicMapping
enabled but when I enable it I get the error

"error": "StrictDynamicMappingException[mapping set to strict, dynamic
introduction of [email.downcased] within [External::User] is not allowed]"

The significant part of my index request looks something like this

PUT /test_app_9/External::User/12
{
"email": "john@john.com",
"email.downcased": "john@john.com",
"name": "John Doe",
"name.downcased": "john doe",
"browser_locale": "en",
.... all other attributes
}

and the significant part of my mapping is as below. What am I doing wrong?

  "mappings": {
     "External::User": {
        "dynamic": "strict",
        "dynamic_templates": [
           {
              "string_custom_data": {
                 "mapping": {
                    "type": "multi_field",
                    "fields": {
                       "{name}": {
                          "index": "no",
                          "type": "string"
                       },
                       "downcased": {
                          "index": "not_analyzed",
                          "type": "string"
                       }
                    }
                 },
                 "match": "*_string"
              }
           },
           {
              "date_custom_data": {
                 "mapping": {
                    "type": "date"
                 },
                 "match": "*_date"
              }
           }
        ],
        "_all": {
           "enabled": false
        },
        "properties": {
           "app_id": {
              "type": "integer"
           },
           "browser_locale": {
              "type": "string",
              "index": "no",
              "fields": {
                 "downcased": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           },
           "email": {
              "type": "string",
              "index": "no",
              "fields": {
                 "downcased": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           },

.....
}

--
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/826c34f9-cc1c-4cea-abea-fdaf7a2d40cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(John O'Gara) #2

Is any extra information required?

On Thursday, September 4, 2014 9:11:17 AM UTC+1, John O'Gara wrote:

I'm having a problem with using strict dynamic mapping and multi-field
values. My multi fields work fine when I don't have StrictDynamicMapping
enabled but when I enable it I get the error

"error": "StrictDynamicMappingException[mapping set to strict, dynamic
introduction of [email.downcased] within [External::User] is not allowed]"

The significant part of my index request looks something like this

PUT /test_app_9/External::User/12
{
"email": "john@john.com",
"email.downcased": "john@john.com",
"name": "John Doe",
"name.downcased": "john doe",
"browser_locale": "en",
.... all other attributes
}

and the significant part of my mapping is as below. What am I doing wrong?

  "mappings": {
     "External::User": {
        "dynamic": "strict",
        "dynamic_templates": [
           {
              "string_custom_data": {
                 "mapping": {
                    "type": "multi_field",
                    "fields": {
                       "{name}": {
                          "index": "no",
                          "type": "string"
                       },
                       "downcased": {
                          "index": "not_analyzed",
                          "type": "string"
                       }
                    }
                 },
                 "match": "*_string"
              }
           },
           {
              "date_custom_data": {
                 "mapping": {
                    "type": "date"
                 },
                 "match": "*_date"
              }
           }
        ],
        "_all": {
           "enabled": false
        },
        "properties": {
           "app_id": {
              "type": "integer"
           },
           "browser_locale": {
              "type": "string",
              "index": "no",
              "fields": {
                 "downcased": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           },
           "email": {
              "type": "string",
              "index": "no",
              "fields": {
                 "downcased": {
                    "type": "string",
                    "index": "not_analyzed"
                 }
              }
           },

.....
}

--
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/2d3f7613-d555-4b61-b50d-ef12a53540b6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Mark O Stewart) #3

Not one reply?
I'm having similar issues and would like to know if you or anyone else has any hints on how to update a field with "dynamic": "strict" set on the index mappings.

I need to change a mis-spelled last name. For instance change Steward to Stewart w/o changing any other data or mappings.


(system) #4