How to disable indexing of unmapped fields

I updated my elasticsearch.yml file to disable automatic index creation
(works great) and to disable indexing of unknown fields (not so great):

action.auto_create_index: false
index.mapper.dynamic: false

I fully shutdown ElasticSearch 0.90.8, then removed the default mappings
that were in elasticsearch.yml, then reinstalled and restarted ES. Existing
test case documents loaded correctly.

But when I added a document with a field that was not defined in the
mapping, the document was added anyway, and the document could be retrieved
by an indexed query against that new field.

Brian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/c22738d6-c900-45b6-a513-1766e1bb71cd%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Perhaps I answered my own question. Doing a bit more research, I found that
the following can be added to the "mappings" object in front of all of the
individual mapped types when the index is created:

"default" : {
"dynamic" : "strict",
"properties" : { }
},

Of course, this doesn't work on existing indices (except when adding new
types, perhaps) but it works fine and throws an exception when I try to
create a new document with a field that is not referenced in the mappings.
Cool!

Brian

--
You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elasticsearch+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/7a70fe2e-53b6-4c39-96fe-955823b6dc76%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.