Not sure I understand, Math.round() requires a float/double as an argument, but returns a long. However the aggregation result will be casted to a float again, if that's what you mean. See this example, of avering two longs
DELETE test
PUT test/_doc/1
{
"key" : 10
}
PUT test/_doc/2
{
"key" : 20
}
GET test/_search
{
"size": 0,
"aggs": {
"avg": {
"avg": {
"field": "key"
}
}
}
}
Is this what you mean with still getting a float? If so, the float should still be the correct value.