# Expecting StrictDynamicMappingException

**URL:** <https://discuss.elastic.co/t/expecting-strictdynamicmappingexception/44870>\
**Category:** Elasticsearch\
**Created:** [March 18, 2016, 9:26pm UTC](https://discuss.elastic.co/t/expecting-strictdynamicmappingexception/44870 "2016-03-18T21:26:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cyang726](https://avatars.discourse-cdn.com/v4/letter/c/838e76/32.png) [@cyang726](https://discuss.elastic.co/u/cyang726)\
**Post date:** [March 18, 2016, 9:26pm UTC](https://discuss.elastic.co/t/expecting-strictdynamicmappingexception/44870/1 "2016-03-18T21:26:37Z")

</div>

Hi,

I have configured the elasticsearch.yml as:  
...  
index.mapper.dynamic: strict  
...

And in my code, I am using index request as:  
...  
IndexRequest indexRequest = new IndexRequest(indexName, indexType, id.toString());  
indexRequest.source(mapper.convertValue(doc, LinkedHashMap.class));  
...  
bulkRequest.add(indexRequest);  
client.bulk(bulkRequest).actionGet();

And my question is that I cannot get any exception when I indexing documents that have fields not in the defined mapping. I am expecting StrictDynamicMappingException and I have a try-catch and throw block for this whole thing.

I am using elasticsearch 1.7.1

Any help would be greatly appreciated.

Thanks,

---

<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 5, 2017, 11:07pm UTC](https://discuss.elastic.co/t/expecting-strictdynamicmappingexception/44870/2 "2017-07-05T23:07:01Z")

</div>


