Expecting StrictDynamicMappingException


(cyang) #1

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,


(system) #2