Hi All,
I have data in Elasticsearch index "vegalite_pivot". While trying to create bar chart with pivot transformation getting below error.
FYI...Provided below index data & vegalite script. Please suggest required changes in the script.
Index Name: vegalite_pivot
Index Data:
POST vegalite_pivot/_bulk
{"index": {}}
{"country": "Norway", "type": "gold", "count": 14}
{"index": {}}
{"country": "Norway", "type": "silver", "count": 14}
{"index": {}}
{"country": "Norway", "type": "bronze", "count": 11}
{"index": {}}
{"country": "Germany", "type": "gold", "count": 14}
{"index": {}}
{"country": "Germany", "type": "silver", "count": 10}
{"index": {}}
{"country": "Germany", "type": "bronze", "count": 7}
{"index": {}}
{"country": "Canada", "type": "gold", "count": 11}
{"index": {}}
{"country": "Canada", "type": "silver", "count": 8}
{"index": {}}
{"country": "Canada", "type": "bronze", "count": 10}
Vegalite Script:
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"autosize": {"type": "fit", "contains": "padding"},
"data": {
"url": {
"index": "vegalite_pivot",
"%context%": true,
"body": {"size": 4000}
},
"format": {"property": "hits.hits"}
},
"transform": [
{
"pivot": "_source.type",
"value": "_source.count",
"groupby": ["_source.country"]
}
],
"mark": "bar",
"encoding": {
"x": {"field": "_source.country", "type": "nominal"},
"y": {"field": "_source.gold", "type": "quantitative"}
}
}
Thanks for the help in advance!
Siva Kumar