Vega-lite vs Kibana

I've this graph definition that works in vega-editor instead using kibana that graph won't render, the error is Cannot read property 'count' of undefined and'source_0') is undefined.
Here there is the json file

  "$schema": "",
  "data": {"url": ""
    "format": {"property": "hits.hits"}
 "transform": [
   {"timeUnit": "yearmonthdatehours", "field": "", "as": "tempo"}  
  "width": 1500, "height": 950, 
  "layer": [
     {"mark": "bar",
      "encoding": {
        "x": {"aggregate": "sum", "field": "_source.count", "type": "quantitative"},
        "y": {"field": "tempo", "type": "temporal"} ,
         "color": {"field": "_source.tipologia", "type": "nominal"}

@pgianf this is a limitation of the older VegaLite version that was used in Kibana. It cannot access sub-fields properly in some case, and you need to extract those subfields to the top level using calculate:

  data: {
    format: {property: "hits.hits"}
  transform: [
    {calculate: "datum._source.count", as: "count"}
    {calculate: "datum._source.tipologia", as: "tipologia"}
    {timeUnit: "yearmonthdatehours", field: "", as: "tempo"}
  width: 1500
  height: 950
  layer: [
      mark: bar
      encoding: {
        x: {aggregate: "sum", field: "count", type: "quantitative"}
        y: {field: "tempo", type: "temporal"}
        color: {field: "tipologia", type: "nominal"}
1 Like

What about mouse over events? is there any differences with Kibana? I cannot see the legend when mouse goes over the bars.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.