Aggregation bucket in Vega returns an object not a bucket

Hi,
I am following a tutorial on Vega visualization on Kibana. The tutorial is similar to draw a graph of bars using aggregation. I followed the steps mentioned in this thread. However, my graph is not displayed, when I debugged the response I noticed that the format does not return the bucket, instead, it returns an object as in the image.

   "body": {
            // "size" : 0,
            "aggs": {
                "authors":{
                  "terms":{"field": "authorId.keyword","size":10 }
               }
            }
        }
           "format": {
            property: "aggregations.authors.buckets"
            
          }   

I'm not sure your formatting is being applied correctly, it looks like it might be in the wrong place in the hierarchy. You can read the improved Vega-Lite tutorial and Vega tutorial to see some examples. Also, in 7.10 there is now an Inspector feature for Vega.

Thank you for your reply. I checked the tutorials. I am using vega not vega-like as the forced graph I am using is not avlaliale in vega-lite. My data format as follows

{"authorId": "X", "title": "X",  "paperCount": 8}
{"authorId": "X2", "title": "X2",  "paperCount": 7}

When I do search in the dev tools for the same equivalent query to the one in the vega above. I got the following:
guery

GET author-terms_elk/_search 
{
  "size": 10,
  "aggs": {
    "authors" :{
      "terms": {
        "field": "authorId.keyword",
        "size": 10
      }
    }
  }
}

response

{
  "took" : 0,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 416,
      "relation" : "eq"
    },
    "max_score" : 1.0,
    "hits" : [
      {
        "_index" : "inx",
        "_type" : "doc",
        "_id" : "0",
        "_source" : {
          "authorId" : "x",
          "title" : "xx",
        }
      },
      { ..}]

That was not exactly what I was asking. I think your Vega spec is not set up right, specifically the format section of your Vega spec. Please try to match the tutorial.

Thanks. Yes, I sorted the format section and it works. The solution is

            property: "dataName.aggName.buckets"

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