I'm using Elasticsearch 2.4. After declaration of index template with one interger field:
curl -XPUT 'localhost:9201/_template/template_1?pretty' -d'
{
"template": "te*",
"mappings": {
"type1": {
"properties": {
"aaa": {
"type": "integer"
}
}
}
}
}
'
and putting to this index a document with number as string:
curl -XPUT 'localhost:9201/template_1/type1/1?pretty' -d'
{
"aaa" : "3"
}
'
I receive as a search result:
curl -XGET 'http://localhost:9201/template_1/_search?pretty=true?q=*:*'
...
"hits" : {
"total" : 1,
"max_score" : 1.0,
"hits" : [ {
"_index" : "template_1",
"_type" : "type1",
"_id" : "1",
"_score" : 1.0,
"_source" : {
"aaa" : "3"
}
} ]
}
Why aaa field is not printed as integer (without quotes) as declared in index template? This field is definitely integer because when I try to assign some characters to aaa there is an exception. But this search result looks confusing and I don't know if Elasticsearch made there implicit conversion to integer or not.