# No data in simple vega lite visualization

**URL:** <https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [May 6, 2020, 6:24am UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273 "2020-05-06T06:24:01Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zonas27](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zonas27/32/67739_2.png) [@zonas27](https://discuss.elastic.co/u/zonas27)\
**Post date:** [May 6, 2020, 6:24am UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/1 "2020-05-06T06:24:01Z")

</div>

Hello, I've been using elastic search/kibana for a couple of months, but I'm very new to vega visualization.  
I have a simple script like this :

```auto
  {
      $schema: https://vega.github.io/schema/vega-lite/v2.json
      title: Event counts from all indexes
      data: {
    url: {
      %context%: true
      %timefield%: @timestamp
      index: fiabdata*
      body: {
        aggs: {
          matricules: {
            terms: {field: "Matricule.raw"}
          }
        }
        size: 0
      }
    }
    format: {property: "aggregations.matricules.buckets"}
      }
      mark: bar
      encoding: {
    x: {
      field: key
      type: ordinal
      axis: {title: "Matricule"}
    }
    y: {
      field: doc_count
      type: quantitative
      axis: {title: "Document count"}
    }
      }
    }

```

The response of the aggregation :

```auto
   '"aggregations" : {
       "matricules" : {
         "doc_count_error_upper_bound" : 522,
         "sum_other_doc_count" : 1374702,
         "buckets" : [
           {
             "key" : "90156811",
             "doc_count" : 2918
           },
           {
             "key" : "90010636",
             "doc_count" : 597
           },
           {
             "key" : "90085981",
             "doc_count" : 585
           },
           {
             "key" : "88219052",
             "doc_count" : 549
           },

```

The problem I have is the graph don't display anything :

 ![vegagraph2](https://us1.discourse-cdn.com/elastic/original/3X/c/9/c9ee5eec20e032f52ed3dc2f2188987cf6a9375e.png)

I have data in the time range I selected.  
I'm on kibana 7.5.0  
Am I missing something ?  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [May 6, 2020, 12:53pm UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/2 "2020-05-06T12:53:23Z")

</div>

Hi @zonas27,

I just gave your example a try and it works well on one of sample kibana datasets.

My only guess is:  
The response of the aggregation you've attached: did you get from browser's dev tools network tab from the request fired by Vega visualization? Or did you get separately, let's say, from Kibana's dev tools when testing the aggregation?

I am thinking if maybe

> %timefield%: @timestamp

is incorrect for your index and it should be something else and not `@timestamp`.

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [May 6, 2020, 1:14pm UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/3 "2020-05-06T13:14:56Z")

</div>

If the suggestion of @dosant doesn't work, please follow the steps outlined in [https://gist.github.com/nyurik/736c34970ba3c32f3fe3d45d66719b3e](https://gist.github.com/nyurik/736c34970ba3c32f3fe3d45d66719b3e) and post the result here. This will help with further debugging.

---

<div class="post-metadata">

**Author:** ![zonas27](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zonas27/32/67739_2.png) [@zonas27](https://discuss.elastic.co/u/zonas27)\
**Post date:** [May 6, 2020, 1:45pm UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/4 "2020-05-06T13:45:59Z")

</div>

Thanks for your answer. I got the response I displayed by kibana Dev tool.  
I've commented %timefield% and it worked !  
As I understood I must put in %timefield% the date field I use for the chronology of my documents ?  
In my case it's named "Measure date" in the documents, the graph worked when I used it.

Thanks for the tip @flash1293 it certainly will be useful in the future.

---

<div class="post-metadata">

**Author:** ![dosant](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/dosant/32/64489_2.png) [@dosant](https://discuss.elastic.co/u/dosant)\
**Post date:** [May 6, 2020, 2:01pm UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/5 "2020-05-06T14:01:05Z")

</div>

> As I understood I must put in %timefield% the date field I use for the chronology of my documents ?

Yes, exactly.  
just instead of `@timestamp` try your field name.

```auto
%timefield%: mytimefield 

```

---

<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:** [June 3, 2020, 2:01pm UTC](https://discuss.elastic.co/t/no-data-in-simple-vega-lite-visualization/231273/6 "2020-06-03T14:01:11Z")

</div>

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