Cannot see data with VEGA

vega
(Lorenzo De Francesco) #1

Hi!
I want visualize data as a Gantt chart, i found some examples online with vega but i don't know why my piece of code does not work:

    {
  "$schema": "https://vega.github.io/schema/vega-lite/v3.json",
  "description": "Gantt chart",
  "data": {
    "name": "data",
    "url": {
      %context%: true
      %timefield%: @timestamp
      "index": "logstash-nemo.apps.webui-*",
      "body": {
        size:3000
        _source:[
          "@timestamp",
          "fields"
        ]
      }
    }
  }
  "transform": [
    {
      "type": "project",
      "fields": ["fields.Method"],
      "as": ["Method"]
    },
    {
      "type": "project",
      "fields": ["fields.startDate"],
      "as": ["startDate"]
    },
    {
      "type": "project",
      "fields": ["fields.endDate"],
      "as": ["endDate"]
    },
  ]
  "mark": "bar",
  "encoding": {
    "y": {"field": "_source.Method", "type": "ordinal"},
    "x": {"field": "_source.startDate", "type": "temporal"},
    "x2": {"field": "_source.endDate", "type": "temporal"}
  }
}

the error is:
Cannot read property 'startDate' of undefined

in addiction kibana rejects my transformations :frowning:
WARN Ignoring an invalid transform: {"as":["endDate"],"fields":["fields.endDate"],"type":"project"}.

Can you help me?

(Joe Reuter) #2

Hey, a good place to start is to check whether the data returned from Elasticsearch actually looks like expected as outlined here: https://www.elastic.co/guide/en/kibana/current/vega-debugging.html#vega-data Maybe the startDate field simply isn't there?

About the second error: Your spec seems to use a version of vega-lite which doesn't have a stable release yet - Kibana currently only supports vega-lite 2.4, so maybe you are using language features which are not availble. Have you tried skipping the transformations and going to the field directly? "y": {"field": "_source.fields.Method", "type": "ordinal"}, (assuming it is there)?

(system) closed #3

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