Imprecise integer handling in script_score?

I have a has_child query (see this posting's bottom) that scores by
children's most recent timestamps (defined as type "date" in the mapping):
"script": "doc['p.created'].value"

But instead of the maximum of the actual timestamps, they are somehow
rounded to a _score of nearby numbers that differ by 120 or 130 each, at
least the more recent ones:
• 1422630910
• 1422630780
• 1422630660
• 1422630530

Suspecting that these integers aren't really handled as such internally, I
tried subtracting a recent timestamp to get the relevant numbers into a
smaller and hence more precisely handled range:
"script": "doc['p.created'].value-1400000000"
And indeed, the minimum difference between the 'rounded' figures was
reduced by a factor of 20, to at most 6. While this largely solves the
problem, it does not do so entirely. Is there a way to get ES to treat
these figures as 'full' integers? I have tried some type-casting in the
Groovy expression – without success.

Thanks in advance for any hints!

The full query:
"query": {
"has_child": {
"type": "p",
"query": {
"function_score": {
"query": {
"match_all": {}
"boost_mode": "replace",
"functions": [
"script_score": {
"script": "doc['p.created'].value",
"lang": "groovy"
"score_mode": "max"

You received this message because you are subscribed to the Google Groups "elasticsearch" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
For more options, visit