Disable dynamic mapping

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Disable dynamic mapping

ppearcy
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
Reply | Threaded
Open this post in threaded view
|

Re: Disable dynamic mapping

kimchy
Administrator
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 <[hidden email]> 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

Reply | Threaded
Open this post in threaded view
|

Re: Disable dynamic mapping

ppearcy
Awesome, thanks!!!

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

On Aug 2, 5:24 pm, Shay Banon <[hidden email]> 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 <[hidden email]> 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