In the Using explicit mapping creation recipe, we saw how ElasticSearch is able to guess the field type using reflection. In this recipe we'll see how to help improve its guessing capabilities.
We can extend the previous mapping adding document-related settings:
{ "order" : { "index_analyzer":"standard", "search_analyzer":"standard", "dynamic_date_formats":["yyyy-MM-dd", "dd-MM-yyyy"], "date_detection":true, "numeric_detection":true, "dynamic_templates":[ {"template1":{ "match":"*", "match_mapping_type":"long", "mapping":{"type":" {dynamic_type}", "store":true} }} ], "properties" : {…} } }