I'd like to use scaled_float on a runtime field/indexed scripted field. We have a calculated field (subtracting two timestamps to get a duration) that needs to be indexed to make visualizations load fast enough. But this can only be stored as a double (or long), which we found out is taking a lot of space because it can't compress doubles well. But we're storing a lot more precision than we need, we're interested in the second or maybe tenth of a second resolution, which scaled_float would handle. But looks like this is not supported (later found that it is documented on https://www.elastic.co/guide/en/elasticsearch/reference/master/number.html)
{
"error": {
"root_cause": [
{
"type": "mapper_parsing_exception",
"reason": "unknown parameter [script] on mapper [test] of type [scaled_float]"
}
],
"type": "mapper_parsing_exception",
"reason": "Failed to parse mapping: unknown parameter [script] on mapper [test] of type [scaled_float]",
"caused_by": {
"type": "mapper_parsing_exception",
"reason": "unknown parameter [script] on mapper [test] of type [scaled_float]"
}
},
"status": 400
}
Workarounds:
We could use an ingest pipeline to calculate the duration. Then we can use scaled_float. But having the ability to do it as a runtime/indexed field is more convenient.
Or we could manually multiply the value by scaling_factor in the script, store it as long, and update dashboards to calculate the real value (but might be slow).
Description
I'd like to use scaled_float on a runtime field/indexed scripted field. We have a calculated field (subtracting two timestamps to get a duration) that needs to be indexed to make visualizations load fast enough. But this can only be stored as a double (or long), which we found out is taking a lot of space because it can't compress doubles well. But we're storing a lot more precision than we need, we're interested in the second or maybe tenth of a second resolution, which scaled_float would handle. But looks like this is not supported (later found that it is documented on https://www.elastic.co/guide/en/elasticsearch/reference/master/number.html)
Workarounds: We could use an ingest pipeline to calculate the duration. Then we can use scaled_float. But having the ability to do it as a runtime/indexed field is more convenient. Or we could manually multiply the value by scaling_factor in the script, store it as long, and update dashboards to calculate the real value (but might be slow).