Config `index.mapper.dynamic: false` is not honored. #15381

Closed
zamblauskas opened this Issue Dec 10, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@zamblauskas

Even with index.mapper.dynamic: false in the config file, automatic mapping is being created.
Documentation states that:

Automatic mapping creation can be disabled by setting index.mapper.dynamic to false in the config files

steps to reproduce

step 1. Make sure setting exists:

cat config/elasticsearch.yml | grep mapper
index.mapper.dynamic: false

step 2. Make sure no mapping or template exists:

curl http://localhost:9200/_mapping
{}
curl http://localhost:9200/_template
{}

step 3. Create an index:

curl -XPUT http://localhost:9200/myindex/mytype/1 -d '{
   "myfield": 1
}'
{"_index":"myindex","_type":"mytype","_id":"1","_version":1,"_shards":{"total":1,"successful":1,"failed":0},"created":true}

step 4. Notice, that a mapping was automatically created:

curl http://localhost:9200/_mapping
{"myindex":{"mappings":{"mytype":{"properties":{"myfield":{"type":"long"}}}}}}

expected

No mapping should be automatically created at step 4.

other info

curl http://localhost:9200
{
  "name" : "master",
  "cluster_name" : "traveltime",
  "version" : {
    "number" : "2.1.0",
    "build_hash" : "72cd1f1a3eee09505e036106146dc1949dc5dc87",
    "build_timestamp" : "2015-11-18T22:40:03Z",
    "build_snapshot" : false,
    "lucene_version" : "5.3.1"
  },
  "tagline" : "You Know, for Search"
}
@clintongormley

This comment has been minimized.

Show comment
Hide comment
@clintongormley

clintongormley Dec 11, 2015

Member

It appears that this parameter is ignored during the index creation process, eg:

PUT t 
{
  "settings": {
    "index.mapper.dynamic": false
  }
}

This throws an exception correctly:

PUT t/x/1
{}

But start a node with --index.mapper.dynamic false, then:

DELETE t

This creates the t index with the x type:

PUT t/x/1
{}    

And this then fails with the correct exception:

PUT t/y/2
{}
Member

clintongormley commented Dec 11, 2015

It appears that this parameter is ignored during the index creation process, eg:

PUT t 
{
  "settings": {
    "index.mapper.dynamic": false
  }
}

This throws an exception correctly:

PUT t/x/1
{}

But start a node with --index.mapper.dynamic false, then:

DELETE t

This creates the t index with the x type:

PUT t/x/1
{}    

And this then fails with the correct exception:

PUT t/y/2
{}

davidvgalbraith pushed a commit to davidvgalbraith/elasticsearch that referenced this issue Dec 14, 2015

Dave
MapperService: check index.mapper.dynamic during index creation
The MapperService doesn't currently check the
index.mapper.dynamic setting during index creation,
so indices can be created with dynamic mappings even
if this setting is false. Add a check that throws an
exception in this case. Fixes #15381
@davidvgalbraith

This comment has been minimized.

Show comment
Hide comment
@davidvgalbraith

davidvgalbraith Dec 14, 2015

Contributor

I took a stab at this one: #15424. Had a little trouble with the test setup so could use some input.

Contributor

davidvgalbraith commented Dec 14, 2015

I took a stab at this one: #15424. Had a little trouble with the test setup so could use some input.

@jpountz jpountz closed this in 3f9c0fb Dec 30, 2015

jpountz added a commit that referenced this issue Dec 30, 2015

MapperService: check index.mapper.dynamic during index creation
The MapperService doesn't currently check the
index.mapper.dynamic setting during index creation,
so indices can be created with dynamic mappings even
if this setting is false. Add a check that throws an
exception in this case. Fixes #15381
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment