Vega visualization Kibana fields

Hello.

I'm trying to obtain a visualization in Kibana using Vega. For this visualization I'm using Kibana getting started guide with the bank data with some added fields. The data goes like this:

{"index":{"_id":"6"}}
{"account_number":6,"balance":5686,"balanceAvailable":5000,"limit":1000,"firstname":"Hattie","lastname":"Bond","age":36,"gender":"M","address":"671 Bristol Street","employer":"Netagy","email":"hattiebond@netagy.com","city":"Dante","state":"TN"}
{"index":{"_id":"13"}}
{"account_number":13,"balance":32838,"balanceAvailable":32838,"limit":1000,"firstname":"Nanette","lastname":"Bates","age":28,"gender":"F","address":"789 Madison Street","employer":"Quility","email":"nanettebates@quility.com","city":"Nogal","state":"VA"}
{"index":{"_id":"18"}}
{"account_number":18,"balance":4180,"balanceAvailable":32838,"limit":1000,"firstname":"Dale","lastname":"Adams","age":33,"gender":"M","address":"467 Hutchinson Court","employer":"Boink","email":"daleadams@boink.com","city":"Orick","state":"MD"}

So far I have this in Vega:

{
  "$schema": "https://vega.github.io/schema/vega/v3.json",
  "width": 400,
  "height": 200,
  "padding": 5,

  "data": [
    {
      "name": "table",
      "values": [
        {"category": "Balance", "amount": 5686},
        {"category": "BalanceAvailable", "amount":686},
        {"category": "limit", "amount": 1000},
      ]
    }
  ],

  "signals": [
    {
      "name": "tooltip",
      "value": {},
      "on": [
        {"events": "rect:mouseover", "update": "datum"},
        {"events": "rect:mouseout",  "update": "{}"}
      ]
    }
  ],

  "scales": [
    {
      "name": "xscale",
      "type": "band",
      "domain": {"data": "table", "field": "category"},
      "range": "width",
      "padding": 0.05,
      "round": true
    },
    {
      "name": "yscale",
      "domain": {"data": "table", "field": "amount"},
      "nice": true,
      "range": "height"
    }
  ],

  "axes": [
    { "orient": "bottom", "scale": "xscale" },
    { "orient": "left", "scale": "yscale" }
  ],

  "marks": [
    {
      "type": "rect",
      "from": {"data":"table"},
      "encode": {
        "enter": {
          "x": {"scale": "xscale", "field": "category"},
          "width": {"scale": "xscale", "band": 1},
          "y": {"scale": "yscale", "field": "amount"},
          "y2": {"scale": "yscale", "value": 0}
        },
        "update": {
          "fill": {"value": "steelblue"}
        },
        "hover": {
          "fill": {"value": "red"}
        }
      }
    },
    {
      "type": "text",
      "encode": {
        "enter": {
          "align": {"value": "center"},
          "baseline": {"value": "bottom"},
          "fill": {"value": "#333"}
        },
        "update": {
          "x": {"scale": "xscale", "signal": "tooltip.category", "band": 0.5},
          "y": {"scale": "yscale", "signal": "tooltip.amount", "offset": -2},
          "text": {"signal": "tooltip.amount"},
          "fillOpacity": [
            {"test": "datum === tooltip", "value": 0},
            {"value": 1}
          ]
        }
      }
    }
  ]
}

What i'm trying to do is to replace the hardcoded values in data with the ones in the index, so I can have real time analysis. I know that might not be possible to select the exact values I want, I just want to be able to select the fields so later I can have a filter with the bank account.
Any suggestion?Thanks

cc @nyuriks might take a look at this when he gets some time.

Cheers
Rashmi

Hi @Sneijky, what exactly you want to visualize? The data you show from Elastic is a bit unclear to me.
There is this Youtube guide by @timroes where he shows how to make a scatterplot on Vega using Elastic data. Also, this blog is about more advanced usage. I would advice you to use first Vega-lite as it is higher level and easier to deal with.

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