Hi all,
I'm new to the ELK Stack, and I'm struggling to create a scripted field properly.
I am polling uptime via SNMP and get a value back in seconds. (Actually in TIMETICKS but yay LogStash for allowing me to convert to seconds before it gets to ElasticSearch.) This is isolated to a specific polling index and if I search within that index using type_instance:prepp_uptime, I see results that look like this:

My goal is to create a scripted field called "Uptime" that is derived from prepp_uptime but displayed as a Duration that's nice and human readable. This is how I configure the top part of the scripted field form:
This is the script I'm attempting to use:
doc['type_instance'].value == 'prepp_uptime' ? doc['value'].value : 0
Here it is after creation:
And here's the error I get when I return to Discover:
Discover: runtime error
 Less Info
OK
Error: Request to Elasticsearch failed: {"error":{"root_cause":[{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType.fielddataBuilder(TextFieldMapper.java:301)","org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:115)","org.elasticsearch.index.query.QueryShardContext.lambda$lookup$0(QueryShardContext.java:279)","org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:88)","org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:85)","java.security.AccessController.doPrivileged(Native Method)","org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:85)","org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:39)","doc['type_instance'].value == 'prepp_uptime' ? doc['value'].value : 0","    ^---- HERE"],"script":"doc['type_instance'].value == 'prepp_uptime' ? doc['value'].value : 0","lang":"painless"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"fetch","grouped":true,"failed_shards":[{"shard":0,"index":"sand-poc_1-polling-2018.02.21","node":"md_sbcCUSRqgvhnYdPa_Lw","reason":{"type":"script_exception","reason":"runtime error","script_stack":["org.elasticsearch.index.mapper.TextFieldMapper$TextFieldType.fielddataBuilder(TextFieldMapper.java:301)","org.elasticsearch.index.fielddata.IndexFieldDataService.getForField(IndexFieldDataService.java:115)","org.elasticsearch.index.query.QueryShardContext.lambda$lookup$0(QueryShardContext.java:279)","org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:88)","org.elasticsearch.search.lookup.LeafDocLookup$1.run(LeafDocLookup.java:85)","java.security.AccessController.doPrivileged(Native Method)","org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:85)","org.elasticsearch.search.lookup.LeafDocLookup.get(LeafDocLookup.java:39)","doc['type_instance'].value == 'prepp_uptime' ? doc['value'].value : 0","    ^---- HERE"],"script":"doc['type_instance'].value == 'prepp_uptime' ? doc['value'].value : 0","lang":"painless","caused_by":{"type":"illegal_argument_exception","reason":"Fielddata is disabled on text fields by default. Set fielddata=true on [type_instance] in order to load fielddata in memory by uninverting the inverted index. Note that this can however use significant memory. Alternatively use a keyword field instead."}}}]},"status":500}
    at http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:575797
    at Function.Promise.try (http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:474114)
    at http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:473502
    at Array.map (<anonymous>)
    at Function.Promise.map (http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:473460)
    at callResponseHandlers (http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:575375)
    at http://127.0.0.1:9999/bundles/commons.bundle.js?v=16573:21:564721
    at processQueue (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:132456)
    at http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:133349
    at Scope.$digest (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:144239)
    at Scope.$apply (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:147018)
    at done (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:100026)
    at completeRequest (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:104697)
    at XMLHttpRequest.xhr.onload (http://127.0.0.1:9999/bundles/vendors.bundle.js?v=16573:123:105435)
Apologies in advance if this post is formatted incorrectly. First time posting here so I'm a n00b.
Any help would be much appreciated.

