# Kibana Vega visualisation - empty aggregation buckets in JS object

**URL:** <https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338>\
**Category:** Kibana\
**Created:** [August 28, 2018, 12:38pm UTC](https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338 "2018-08-28T12:38:53Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![krakora](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@krakora](https://discuss.elastic.co/u/krakora)\
**Post date:** [August 28, 2018, 12:38pm UTC](https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338/1 "2018-08-28T12:38:53Z")

</div>

Dear team,

I like create a word cloud visualisation like the one in [https://vega.github.io/vega/examples/word-cloud/](https://vega.github.io/vega/examples/word-cloud/) but I got stuck in Vega data object definition.

Using the Kibana Dev tools I can search query

```auto
GET /_search
{
  "size": 0,
  "aggs": {
    "messages": {
      "terms": {
        "field": "log_message.keyword"
      }
    }
  }
}

```

that returns result as follows:

```auto
{
  "took": 0,
  "timed_out": false,
  "_shards": {
    "total": 17,
    "successful": 17,
    "skipped": 0,
    "failed": 0
  },
  "hits": {
    "total": 65657,
    "max_score": 0,
    "hits": []
  },
  "aggregations": {
    "messages": {
      "doc_count_error_upper_bound": 0,
      "sum_other_doc_count": 0,
      "buckets": [
        {
          "key": "Cannot convert null to 'System.DateTime' because it is a non-nullable value type",
          "doc_count": 33
        },
        {
          "key": "Create: Customer code is not in required ERP format!",
          "doc_count": 31
        },
        {
          "key": "IMEI: 00-0F-33-35-32-30-39-33-30-38-31-36-35-39-38-38-39",
          "doc_count": 2
        },
        {
          "key": "IMEI: confirmed",
          "doc_count": 2
        },
        {
          "key": "data confirmation: 00-00-00-01",
          "doc_count": 2
        }
      ]
    }
  }
}

```

Using the Vega approach:

```auto
{
  // Cloud example: https://vega.github.io/vega/examples/word-cloud/

  $schema: https://vega.github.io/schema/vega-lite/v2.json
  title: Cloud from all messages

  // Data source
  data: {
    url: {
      // ES 
      %context%: true
      %timefield%: @timestamp
      // All indexes
      index: _all
      // Aggregate data
      body: {
        aggs: {
          messages: {
            terms: {
              field: log_class.keywords
            }
          }
        }
      }
    }
  // Filter the object
  // format: {property: "aggregations.messages.buckets"}
  
  }
  
  // "mark" 
  mark: {
    type: "text"
    // ...
  }
}

```

the Chrome JS console shows empty aggregation object

![image](https://us1.discourse-cdn.com/elastic/original/3X/e/3/e3bb1d68bf3b555bf6fd99c3575a426e6ce7f173.png)

Do you have any hint?

Thank you in advance

BR  
Jan

---

<div class="post-metadata">

**Author:** ![Bill\_McConaghy](https://avatars.discourse-cdn.com/v4/letter/b/ed655f/32.png) [@Bill\_McConaghy](https://discuss.elastic.co/u/Bill_McConaghy)\
**Post date:** [August 28, 2018, 12:43pm UTC](https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338/2 "2018-08-28T12:43:26Z")

</div>

> [@krakora](#):
>
> field: log\_class.keywords

I think that line in your vega config should be: `field: log_class.keyword`

---

<div class="post-metadata">

**Author:** ![krakora](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@krakora](https://discuss.elastic.co/u/krakora)\
**Post date:** [August 28, 2018, 1:39pm UTC](https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338/3 "2018-08-28T13:39:34Z")

</div>

Thank you Bill.

Moreover, I have found other issues in my Vega code:

```auto
...
 $schema: https://vega.github.io/schema/vega/v3.json
...
data: {
  name: "table"
  url: {
...
field: log_class.keyword
...

```

---

<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:** [September 25, 2018, 1:39pm UTC](https://discuss.elastic.co/t/kibana-vega-visualisation-empty-aggregation-buckets-in-js-object/146338/4 "2018-09-25T13:39:39Z")

</div>

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