Running 5.1.1, followed the 5.1 docs and set a template and setting on the mapping definition and it still creates dynamic mappings.
Set template to disable dynamic mapping for all:
curl -XPUT 'http://localhost:9200/_template/template_all' -d ' { "template": "*", "order":0, "settings": { "index.mapper.dynamic": false } }'
Create mapping:
curl -XPUT 'http://localhost:9200/test_schema' -d ' { "mappings": { "test_type": { "properties": { "foo": { "type": "string" } } } } }'
Set mapping to disable dynamic mapping (since setting template failed to disable):
curl -XPUT 'http://localhost:9200/test_schema/_settings' -d ' { "index.mapper.dynamic":false }'
Attempt to index data with missing field mapping definition, should fail, but doesn't:
curl -XPUT 'http://localhost:9200/test_schema/test_type/1' -d ' { "foo": "hello", "bar": "should cause error" }'
Successful, but should have thrown error:
{"_index":"test_schema","_type":"test_type","_id":"1","_version":1,"result":"created","_shards":{"total":2,"successful":1,"failed":0},"created":true}
Get the mapping to see if it contains the dynamic mapping:
Yep, sure does, but shouldn't:
dev@ip-172-31-10-217:~/workspace/generic-schema-scale-test$ curl http://localhost:9200/test_schema/_mapping?pretty=true { "test_schema" : { "mappings" : { "test_type" : { "properties" : { "bar" : { "type" : "text", "fields" : { "keyword" : { "type" : "keyword", "ignore_above" : 256 } } }, "foo" : { "type" : "text" } } } } } }