# How to disable indexing of unmapped fields

**URL:** <https://discuss.elastic.co/t/how-to-disable-indexing-of-unmapped-fields/15117>\
**Category:** Elasticsearch\
**Created:** [January 6, 2014, 10:03pm UTC](https://discuss.elastic.co/t/how-to-disable-indexing-of-unmapped-fields/15117 "2014-01-06T22:03:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [January 6, 2014, 10:03pm UTC](https://discuss.elastic.co/t/how-to-disable-indexing-of-unmapped-fields/15117/1 "2014-01-06T22:03:04Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [January 6, 2014, 10:18pm UTC](https://discuss.elastic.co/t/how-to-disable-indexing-of-unmapped-fields/15117/2 "2014-01-06T22:18:23Z")

</div>

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](mailto: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](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](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:58am UTC](https://discuss.elastic.co/t/how-to-disable-indexing-of-unmapped-fields/15117/3 "2017-07-06T01:58:09Z")

</div>


