# Why is data from elasticsearch not being updated?

**URL:** <https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [April 26, 2023, 9:04am UTC](https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810 "2023-04-26T09:04:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![edgarmat1964](https://avatars.discourse-cdn.com/v4/letter/e/a3d4f5/32.png) [@edgarmat1964](https://discuss.elastic.co/u/edgarmat1964)\
**Post date:** [April 26, 2023, 9:04am UTC](https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810/1 "2023-04-26T09:04:36Z")

</div>

LS,

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

```auto
{
  "$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.

---

<div class="post-metadata">

**Author:** ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)\
**Post date:** [April 26, 2023, 6:17pm UTC](https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810/2 "2023-04-26T18:17:10Z")

</div>

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.

 ![Screenshot 2023-04-26 at 2.14.30 PM](https://us1.discourse-cdn.com/elastic/original/3X/a/4/a44e747337f95eeb16d769a82953397747ca044c.png)

---

<div class="post-metadata">

**Author:** ![edgarmat1964](https://avatars.discourse-cdn.com/v4/letter/e/a3d4f5/32.png) [@edgarmat1964](https://discuss.elastic.co/u/edgarmat1964)\
**Post date:** [May 3, 2023, 11:50am UTC](https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810/3 "2023-05-03T11:50:08Z")

</div>

Hi Nick,

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

Kinds regards, Edgar.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 31, 2023, 11:50am UTC](https://discuss.elastic.co/t/why-is-data-from-elasticsearch-not-being-updated/330810/4 "2023-05-31T11:50:31Z")

</div>

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