I'm trying to use Vega to create a boxplot with my elastic index data. My Vega code is here.
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"height": 400,
"width": 100
"title": "Bootstrapped Model Metric Comparisons",
data: {
name: boxplot_data
url: {
%context%: true
index: boxplot_data_new
body: {
size: 100
_source: ["Model", "Category", "Metric_Val"]
}
}
# We only need the content of hits.hits array
format: {property: "hits.hits"}
"transform":[
{
"type":"formula",
"expr":"datum._source.Category",
"as":"category"
},
{
"type":"formula",
"expr":"datum._source.Metric_Val+0",
"as":"metric_value"
}
]
}
"mark": {
"type": "boxplot",
"extent": 1.5
}
"encoding": {
"column": {
"field": "_source.Category",
"type": "nominal",
"title": "Category"},
"y": {
"field": "_source.Metric_Val",
"type": "quantitative",
"title": "Metric"
},
"x": {
"field": "_source.Model",
"type": "nominal",
"title": false,
"axis": {"labels": false}
},
"color": {
"field": "_source.Model",
"type": "nominal",
"title": ""
}
}
}
My elastic index data looks like this.
{
"took": 1,
"timed_out": false,
"_shards": {
"total": 1,
"successful": 1,
"skipped": 0,
"failed": 0
},
"hits": {
"total": 30,
"max_score": 1,
"hits": [
{
"_index": "boxplot_data_new",
"_id": "kYbYyJEB_-YoQLLCVWnv",
"_score": 1,
"_source": {
"Model": "Model 1",
"Category": "Category 1",
"Metric_Val": 0
}
},
{
"_index": "boxplot_data_new",
"_id": "kobYyJEB_-YoQLLCVWnw",
"_score": 1,
"_source": {
"Model": "Model 1",
"Category": "Category 1",
"Metric_Val": 0.25
}
},
But I'm getting the two errors shown below:
Any help is appreciated!