Decay scores based on value of a script field

Is it possible to decay the scores of documents based on the value of a script field?

I've got an index of documents which include an array of dates as unixtimestamps

"dates": [ 1447372800, 1447459200, 1447545600, 1447718400, 1447804800, 1447891200 ]

and I've created a groovy script to return the first timestamp which is greater than or equal to today

soonestFutureDate = doc['dates'].find { it >= todayTimestamp}; return soonestFutureDate;

which returns a 'fields' object when queried

"fields": { "soonestFutureDate": [ 1447372800 ] }

This is the value (the soonest future date) which I'm trying to decay the document scores with.

I've tried to access fields.sooonestFutureDate in a function score query

{ "query": { "function_score": { "functions": [ { "gauss": { "fields.soonestFutureDate": { "origin": "0", "scale": "20" } } } ], "query": { "match_all": {} }, "score_mode": "multiply" } } }

but get a query parsing error in return

nested: QueryParsingException[[di_events] Unknown field [fields.soonestFutureDate]]

I've also tried to use a script_score to return the value of soonestFutureDate, and then access that score in the decay function

{ "query": { "function_score": { "functions": [ { "script_score": { "script" : "sort_by_date", "params" : { "factor" : 1442448000 } } }, { "gauss": { "_score": { "origin": "0", "scale": "20" } } } ], "query": { "match_all": {} }, "score_mode": "multiply" } } }

which also returns a query parsing error

nested: QueryParsingException[[di_events] Unknown field [_score]]; }]"

So I am clearly doing it wrong! Is what I'm trying to do possible?

Thanks.