How to access data from Elasticsearch in VEGA with nested aggregations

Hi,

I try to do a, sort of gantt chart, in VEGA. This chart should display on x-axes the time and on y-axes devices been used. So the user can adjust with the time picker and sees all devices been used in this period of time.

When debugging i see that there is the data, but i don´t know how to access it.

vegadebug

So basically the question is, as shown in the image, I want the key from timebuckets.buckets on the x-axes and the key from timebuckets.buckets.tags.buckets on the y-axes (device names)

{

  "$schema": "https://vega.github.io/schema/vega/v4.json",

  "data": {

  "name":"mydata",

    "url": {

      "%context%": true,

      "%timefield%": "time",

      "index": "myIdx",

      "body": {

      "size": 0,

    "aggs" : {

        "time_buckets" : {

           "date_histogram" : {

                "field" : "time",

                "interval" : "1d"

            },

            "aggs": {

                "tags": {

                    "terms": {

                        "field": "deviceName.keyword",

                        "size":10

                    }

                }

            }

        }}

    },

    "format": {"property": "aggregations.time_buckets.buckets"} // is this correct?

  }},

So i´m not sure about the "format" and about accessing the key values in a "marks" to draw the chart.
Do i need the transform for the time? Any help on this would be nice!

Thanks in advance Oliver

Hi @elasticUser6
sorry for the late reply, I'd like to check with you if you already solved your issue, if so can you post how so other community member can learn that, if not I can give you some help on that

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