Vega pie properties error converting github example to Kibana vega using a query with agg

I am getting this error

Invalid specification {...}
Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat"

I was using the pie chart from the github examples and using the kibana sample data logs. I made a range query for the last 90 days and an agg for doc count of the source and destination doc counts by terms.
I tried to convert the pie chart that works from the github examples for vega but as a newbie to vega I am missing something here, since a relative 1 for 1 swap between example and test does not work:

{
  $schema: https://vega.github.io/schema/vega-lite/v5.json
  description: A basic donut chart example
  width: 500
  height: 500
  autosize: none

  signals: [
    name: startAngle, value: -1.55
    name: endAngle, value: 1.55
    name: padAngle, value: 0.01
    name: innerRadius, value: 190
    name: cornerRadius, value: 0
    name: sort, value: true
  ],

  data: {
    name: query,
    url: {
      index: kibana_sample_data_logs
      body: {
        query: {
          range: {
            "@timestamp": {
              gte: "now-30d",
              lte: "now"
            }
          }
        },
        aggs: {
          test: {
            terms: {
              field: "geo.srcdest",
              order: {
                "_key": "asc"
              }
            }
          }
        }
      }
    }
  },

  transform: [
    {
      type: "pie",
      field: "doc_count",
      startAngle: {signal: "startAngle"},
      endAngle: {signal: "endAngle"},
      sort: {signal: "sort"}
    }
  ],

  scales: [
    {
      name: "color",
      type: "ordinal",
      domain: {data: "query", field: "geo.srcdest"},
      range: {scheme: "category20"}
    }
  ],

  marks: [
    {
      type: arc,
      from: {data: "table"},
      encode: {
        enter: {
          fill: {scale: "color", field: "geo.srcdest"},
          x: {signal: "width / 2"},
          y: {signal: "height / 2"}
        },
        update: {
          startAngle: {field: "startAngle"},
          endAngle: {field: "endAngle"},
          padAngle: {signal: "padAngle"},
          innerRadius: {signal: "innerRadius"},
          outerRadius: {signal: "width / 2"},
          cornerRadius: {signal: "cornerRadius"}
        }
      }
    }
  ]
}

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