# Simplest example of Vega doesn't seem to work

**URL:** <https://discuss.elastic.co/t/simplest-example-of-vega-doesnt-seem-to-work/198657>\
**Category:** Kibana\
**Tags:** vega\
**Created:** [September 9, 2019, 10:23am UTC](https://discuss.elastic.co/t/simplest-example-of-vega-doesnt-seem-to-work/198657 "2019-09-09T10:23:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ismaelestalayo](https://avatars.discourse-cdn.com/v4/letter/i/f475e1/32.png) [@ismaelestalayo](https://discuss.elastic.co/u/ismaelestalayo)\
**Post date:** [September 9, 2019, 10:23am UTC](https://discuss.elastic.co/t/simplest-example-of-vega-doesnt-seem-to-work/198657/1 "2019-09-09T10:23:06Z")

</div>

The following GET request to ElasticSearch works correctly:

```auto
GET traffic_original/_search {
  "size": 2,
  "_source": ["swPort", "size", "srcIP", "dstIP"]
}

```

Response:

```auto
{
  "took" : 9,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 1.0,
    "hits" : [
      { "_index" : "traffic_original",
        "_type" : "record",
        "_id" : "6Iq0BW0BCid0EqM8JVNC",
        "_score" : 1.0,
        "_source" : {
          "srcIP" : "10.11.0.133",
          "size" : 68,
          "swPort" : 43,
          "dstIP" : "10.5.6.126"
        }
      },
      { "_index" : "traffic_original",
        "_type" : "record",
        "_id" : "6Yq0BW0BCid0EqM8JVNC",
        "_score" : 1.0,
        "_source" : {
          "srcIP" : "10.11.0.133",
          "size" : 70,
          "swPort" : 43,
          "dstIP" : "10.5.6.126"
        }
      }
    ]
  }
}

```

But despite that, I haven't been able to make a simple Vega chart to test its functionality. Here's one of the many code variations I've tried:

```auto
{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  mark: rect
  data: {
    url: {
      %context%: true
      index: traffic_original,
      body: {
        size: 100
        _source: ["swPort", "size"] } }
    format: {property: "hits.hits"}
  }
  encoding: {
    x: { 
      field: swPort
      type: quantitative
      axis: {title: "X Axis"}
    }
    y: {
      field: size
      type: quantitative
      axis: {title: "Size"}
    }
  }
}

```

I don't really mind what to plot, I just wanna see a working example from where to iterate.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [September 11, 2019, 9:47pm UTC](https://discuss.elastic.co/t/simplest-example-of-vega-doesnt-seem-to-work/198657/2 "2019-09-11T21:47:58Z")

</div>

@nyuriks- can u please guide here

Thanks  
Rashmi

---

<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:** [October 9, 2019, 9:48pm UTC](https://discuss.elastic.co/t/simplest-example-of-vega-doesnt-seem-to-work/198657/3 "2019-10-09T21:48:04Z")

</div>

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