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

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
Copy link

commented Dec 10, 2015

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.

Copy link
Member

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 elastic#15381
@davidvgalbraith

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.