Reputation: 24150
I have elastic search stack: Where I have template
{
"template": "vivek-*",
"settings": {
"number_of_shards": 40,
"index.mapper.dynamic": true
},
"dynamic_templates": [
{
"date": {
"match": "*Utc",
"mapping": {
"type": "date"
}
}
}
],
"mappings": {
"vivek": {
"_source": {
"enabled": true
},
"properties": {
}
}
}
} I am putting following document:
{
"attribute1Utc": 1483999887069
}
Elastic search is still detecting it as: attribute1Utc number
Upvotes: 0
Views: 858
Reputation: 217304
You've simply got your mapping wrong, the dynamic_templates
section needs to go inside the mapping type, like this. It will work afterwards.
{
"template": "vivek-*",
"settings": {
"number_of_shards": 40,
"index.mapper.dynamic": true
},
"mappings": {
"vivek": {
"_source": {
"enabled": true
},
"dynamic_templates": [
{
"date": {
"match": "*Utc",
"mapping": {
"type": "date"
}
}
}
],
"properties": {}
}
}
}
Upvotes: 2