Disable dynamic mapping


(ppearcy) #1

Hello,
I would like to disable dynamic mappings in the 0.9 release. I
attempted do do this globally in the elasticsearch.yml by adding this:
index:
mapper:
dynamic: false

I also tried to disable dynamic mappings at index creation with this
data (in the form of a python dict):
{'index':{'number_of_shards':5,'number_of_replicas':0,'mapper':
{'dynamic':False}}}

Regardless of what I do, when I check the mapping status, I see:
dynamic: true

Also, when I submit a doc with unknown fields, they end up getting
indexed.

Is there anything that I am missing? Has anyone else been able to
disable dynamic mapping?

Many Thanks!
Paul


(Shay Banon) #2

When you set the index.mapper.dynamic to false it means that new types will
not be allowed to be introduced without declaring them first. If you want to
disable dynamic option on the root object level mapping, then you will need
to set dynamic to false on the root level object mapping that you define (or
set it on the default mapping).

-shay.banon

On Tue, Aug 3, 2010 at 2:17 AM, Paul ppearcy@gmail.com wrote:

Hello,
I would like to disable dynamic mappings in the 0.9 release. I
attempted do do this globally in the elasticsearch.yml by adding this:
index:
mapper:
dynamic: false

I also tried to disable dynamic mappings at index creation with this
data (in the form of a python dict):
{'index':{'number_of_shards':5,'number_of_replicas':0,'mapper':
{'dynamic':False}}}

Regardless of what I do, when I check the mapping status, I see:
dynamic: true

Also, when I submit a doc with unknown fields, they end up getting
indexed.

Is there anything that I am missing? Has anyone else been able to
disable dynamic mapping?

Many Thanks!
Paul


(ppearcy) #3

Awesome, thanks!!!

I added 'dynamic':False to my put mappings and that did the trick.

On Aug 2, 5:24 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

When you set the index.mapper.dynamic to false it means that new types will
not be allowed to be introduced without declaring them first. If you want to
disable dynamic option on the root object level mapping, then you will need
to set dynamic to false on the root level object mapping that you define (or
set it on the default mapping).

-shay.banon

On Tue, Aug 3, 2010 at 2:17 AM, Paul ppea...@gmail.com wrote:

Hello,
I would like to disable dynamic mappings in the 0.9 release. I
attempted do do this globally in the elasticsearch.yml by adding this:
index:
mapper:
dynamic: false

I also tried to disable dynamic mappings at index creation with this
data (in the form of a python dict):
{'index':{'number_of_shards':5,'number_of_replicas':0,'mapper':
{'dynamic':False}}}

Regardless of what I do, when I check the mapping status, I see:
dynamic: true

Also, when I submit a doc with unknown fields, they end up getting
indexed.

Is there anything that I am missing? Has anyone else been able to
disable dynamic mapping?

Many Thanks!
Paul


(system) #4