Why is data from elasticsearch not being updated?

LS,

I have a "simple" vega script to extract data from elasticsearch to "visualize":

{
  "$schema": "https://vega.github.io/schema/vega/v5.json",
  "width": 400, "height": 70,
  "padding": 5,
  "autosize": "none",
  "bgColor": "green",
  "data":
  {
    name: "statusData",
    url:
    {
      index: "my-index",
      %context%: "true",
      %timefield% : "@timestamp",
      body:
      {
        _source: [
          "@timestamp",
          "availStatus",
          "availStatusNr",
          "cluster*"
        ],
        sort: [ {"@timestamp": "desc"}],
        size: 1
      }
    },
    format: {property: "hits.hits"},
    transform: [
      {
        # This doesn't seem to work...
        "type": "formula",
        "expr": "if ('datum._source.availStatusNr > 0','green','red')",
        "as": "myColor"
      }
    ]
  },
  "background": "green" # "background": { "field": "bgColor" } # this doesn't work anyway...
  "marks": [
    {
      "type": "text",
      "from": { data: "statusData" },
      "encode": {
        "update": {
          "text":     { "field": "_source.@timestamp" },
          "font":     { "value": "inter" },
          "fontSize": { "value": "24" },
          "align":    { "value": "center"},
          "baseline": { "value": "middle"},
          "stroke":   { "value": "white" },
          "x":        { "signal": "width/2" },
          "y":        { "signal": "height/2" },
        }
      }
    }
  ]
}

It shows a text box containing @timestamp. Except, it's static. Every minute there's data added to the "my-index" in ES, but the visual is not updated. Question is why?

And yes, this is just some test code...

Kind regards, Edgar.

Hi Edgar.

It sounds like you expect the visualization to update periodically with data from Elasticsearch. You can specify a Refresh interval in the Time picker.

Hi Nick,

facepalm... Stupid of me to miss something so simple... Thanks!

Kinds regards, Edgar.

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