# Vega does not show anything from elasticsearch query

**URL:** <https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614>\
**Category:** Kibana\
**Created:** [May 21, 2018, 6:05am UTC](https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614 "2018-05-21T06:05:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![michaelcheung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaelcheung/32/53285_2.png) [@michaelcheung](https://discuss.elastic.co/u/michaelcheung)\
**Post date:** [May 21, 2018, 6:05am UTC](https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614/1 "2018-05-21T06:05:17Z")

</div>

My visualize query:

```auto
{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  title: Event counts from all indexes
  data: {
    url: {
      index: index-*
      body: {
        query: {
          bool: {
            must: [
              {
                range: {
                  @timestamp: {gt: "now-15m"}
                }
              }
              {
                match: {logStatus: "success"}
              }
            ]
          }
        }
        size: 20
      }
    }
    format: {property: "hits.hits"}
  }
  mark: circle
  encoding: {
    x: {
      field: _source.@timestamp
      type: temporal
      axis: {title: "time"}
    }
    y: {
      field: _source.logEvent
      type: nominal
      axis: {title: "event"}
    }
  }
}

```

I checked browser network and there is `_search` request with correct data in response. I just see the chart showing title and legends, but there is no data. What is wrong in the above visualize query object?

---

<div class="post-metadata">

**Author:** ![michaelcheung](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/michaelcheung/32/53285_2.png) [@michaelcheung](https://discuss.elastic.co/u/michaelcheung)\
**Post date:** [May 21, 2018, 7:03am UTC](https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614/2 "2018-05-21T07:03:08Z")

</div>

Found the problem. The `@timestamp` field needs to be transformed after search.  
I put these lines after `data`.

```auto
  transform: [
    {calculate: "toDate(datum._source['@timestamp'])", as: "time"}
  ]

```

Then change x-axis field to `time`.

---

<div class="post-metadata">

**Author:** ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)\
**Post date:** [May 21, 2018, 1:45pm UTC](https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614/3 "2018-05-21T13:45:25Z")

</div>

Hey @michaelcheung, I'm glad to hear that you were able to figure out the solution to your problem, thanks for sharing it here for others to find!

---

<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 18, 2018, 1:45pm UTC](https://discuss.elastic.co/t/vega-does-not-show-anything-from-elasticsearch-query/132614/4 "2018-06-18T13:45:27Z")

</div>

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