Using the percentile aggregate, elasticsearch returns results wherein the key contains a period. Like so:
"score_outlier": {
"values": {
"1.0": 1,
"5.0": 1,
"25.0": 2,
"50.0": 3,
"75.0": 3,
"95.0": 5,
"99.0": 5
}
}
When visualizing, vega lite indicates that you should escape any fields containing periods using a double backslash: \\
.
This works totally fine in the encodings, like here:
{
"mark": {"type": "bar", "style": "box"},
"encoding": {
"y": {"field": "score_outlier.values.25\\.0", "type": "quantitative"},
"y2": {"field": "score_outlier.values.75\\.0", "type": "quantitative"},
"x": {"field": "key", "type": "nominal"},
"color": {"value": "steelblue"},
"size": {"value": 11}
}
}
But if I do the same thing during a calculate
transform, I get a Parse Error from Vega. Here is an example which fails:
"transform": [
{
"calculate": "datum.score_outlier.values.75\\.0 - datum.score_outlier.values.25\\.0",
"as": "iqr"
}
]
Which returns:
Expression parse error: "datum.score_outlier.values.75\\.0 - datum.score_outlier.values.25\\.0"
I've tried not escaping, double-escaping, using square bracket indexing, but nothing seems to work. Am I missing something? The moment I switch this calculation to use a field that doesn't contain a period, all is well.
Thanks for any insights