Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic templates from an index template are skipped if a new type already have dynamic templates #3538

Closed
bleskes opened this Issue Aug 19, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@bleskes
Copy link
Member

bleskes commented Aug 19, 2013

The two dynamic templates lists should be merged.

Example:

Add a template:

curl -XPUT "http://localhost:9200/_template/template_1" -d'
{
   "template": "te*",
   "mappings": {
      "type1": {
         "dynamic_templates": [
            {
               "t1": {
                  "match": "*",
                  "mapping": {
                     "store": "yes"
                  }
               }
            }
         ]
      }
   }
}'

create a type:

curl -XPUT "http://localhost:9200/test1" -d'
{
   "mappings": {
      "type1": {
         "dynamic_templates": [
            {
               "t2": {
                  "match": "t*",
                  "mapping": {
                     "store": "no"
                  }
               }
            }
         ]
      }
   }
}'

Now get the mappings for the newly created type:

curl -XGET "http://localhost:9200/test1/_mapping"

which gives (note that the t1 template is missing):

{
   "test1": {
      "type1": {
         "dynamic_templates": [
            {
               "t2": {
                  "mapping": {
                     "store": "yes"
                  },
                  "match": "t*"
               }
            }
         ],
         "properties": {}
      }
   }
}

@ghost ghost assigned bleskes Aug 19, 2013

bleskes added a commit that referenced this issue Aug 19, 2013

XContentHelper.mergeDefaults with single key object list ([ { key: ..…
… } , {key : ... } .. ] ) didn't add defaults which were not already in content

 Closes #3538

@bleskes bleskes closed this in 11fab5c Aug 19, 2013

mute pushed a commit to mute/elasticsearch that referenced this issue Jul 29, 2015

XContentHelper.mergeDefaults with single key object list ([ { key: ..…
… } , {key : ... } .. ] ) didn't add defaults which were not already in content

 Closes elastic#3538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.