Set data type for object in template

I have a template created so that one of the fields is recognised as an integer/long type instead of a string, however it doesn't take effect.

Here's the template I have set up:

"templatename": {
  "mappings": {
    "doc": {
      "properties": {
        "event_data": {
           "type": "object",
           "properties": {
             "CSEElaspedTimeInMilliSeconds": {
             "type": "long"
             }
           }
         }
       }
     }
  }
}

And here's the raw object looks like this:

{
  "_type": "doc",
  "_source": {
    "event_data": {
      "ErrorCode": "0",
      "CSEExtensionName": "Registry",
      "CSEExtensionId": "{35378EAC-683F-11D2-A89A-00C04FBBCFA2}",
      "CSEElaspedTimeInMilliSeconds": "905"
    }
 }
}

However the field is still being presented as a text field, even after creating a new index.
Anyone able to point me in the right direction?

Edit:
There was nothing wrong with the template - I just had to refresh the field list for the index patterns!

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