Map numeric data to float , integer, long and double datatype

I'd like to use template and map fields accordingly to field's name suffix to : interger, long, float and double.
I use the following template:
"dynamic_templates": [
{
"integer_fields": {
"match": "_i_en",
"match_mapping_type": "integer",
"mapping": { "type": "integer" }
}
},
{
"long_fields": {
"match": "
_l_en",
"match_mapping_type": "long",
"mapping": { "type": "long" }
}
},
{
"float_fields": {
"match": "_f_en",
"match_mapping_type": "float",
"mapping": { "type": "float" }
}
},
{
"double_fields": {
"match": "
_d_en",
"match_mapping_type": "double",
"mapping": { "type": "double" }
}
},
....

When I get result using java RestClient from the index see that that for Integer and long fields the value fetched as Integer while for float and double fields get the value as Double. How can I enforce that long field be return as Long and not as Integer, and float value be Float and not Double?

When i try to create such mapping I got the message in Kibana console:

#! Deprecation: match_mapping_type [integer] is invalid and will be ignored: No field type matched on [integer], possible values are [object, string, long, double, boolean, date, binary]
#! Deprecation: match_mapping_type [float] is invalid and will be ignored: No field type matched on [float], possible values are [object, string, long, double, boolean, date, binary]

So how to map properly float for float datatype and integer to integer datatype if all these data type are supported according to documentation , see https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-types.html

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.