# Kibana -- Transform / Window / Rank not working in Vega v2

**URL:** <https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749>\
**Category:** Kibana\
**Created:** [August 23, 2018, 2:14pm UTC](https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749 "2018-08-23T14:14:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![perryparktung](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@perryparktung](https://discuss.elastic.co/u/perryparktung)\
**Post date:** [August 23, 2018, 2:14pm UTC](https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749/1 "2018-08-23T14:14:56Z")

</div>

Hi,

My Vega code seems not working. I'm using Vega v2. I copied the sample online for window transform =\> rank operation, but the "rank" field is not showing up. I put a tooltip for field "exe" to show that it actually has a value. Please advise what is going wrong... This is driving me crazy!

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

```
{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  config: {
    kibana: {
      tooltips: {centerOnMark: true, position: "top", padding: 20}
    }
  }
  data: {
    url: {
      %context%: true
      %timefield%: @timestamp
      index: *
      body: {
        size: 10000
        _source: ["@timestamp", "end_time", "step_path", "execution_duration"]
      }
    }
    format: {property: "hits.hits"}
  }
  transform: [
    {calculate: "datum._source.step_path", as: "Step"}
    {calculate: "datum._source.execution_duration", as: "Duration(ms)"}
    {filter: "datum._source.step_path != null"}
    {
      aggregate: [
        {op: "average", format: ".2f", field: "Duration(ms)", as: "exe"}
      ]
      groupby: ["Step"]
    }
    {
      window: [
        {op: "rank", as: "rank"}
      ]
      sort: [
        {field: "exe", order: "descending"}
      ]
      groupby: ["Step"]
    }
  ]
  mark: {type: "bar"}
  encoding: {
    y: {
      field: Step
      type: ordinal
      axis: {title: "Step"}
    }
    x: {field: "rank", type: "ordinal"}
    tooltip: {field: "exe", type: "nominal"}
    color: {field: "Step", type: "nominal", "nominalColorRange ": "category10"}
  }
}
```

---

<div class="post-metadata">

**Author:** ![nyuriks](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nyuriks/32/26171_2.png) [@nyuriks](https://discuss.elastic.co/u/nyuriks)\
**Post date:** [August 24, 2018, 1:07pm UTC](https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749/2 "2018-08-24T13:07:21Z")

</div>

Hi @perryparktung,

I really need to see the data that you are trying to plot. Without it it would be very hard to debug the issue. Could you use `JSON.stringify(VEGA_DEBUG.vegalite_spec)` command from the browser debug tool (console) to copy your graph including the data, and attach it as a zip file to the issue? Make sure to expand the output to include everything.

Thanks!

---

<div class="post-metadata">

**Author:** ![isharamet](https://avatars.discourse-cdn.com/v4/letter/i/848f3c/32.png) [@isharamet](https://discuss.elastic.co/u/isharamet)\
**Post date:** [September 10, 2018, 11:18am UTC](https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749/3 "2018-09-10T11:18:48Z")

</div>

Got the same issue in Kibana 6.3. Couldn't make it work even with the official Vega-Lite example: [https://vega.github.io/vega-lite/docs/window.html#top-k](https://vega.github.io/vega-lite/docs/window.html#top-k) - got kibana.bundle.js?v=16602:1 WARN Ignoring an invalid transform: {"sort":[{"field":"score","order":"descending"}],"window":[{"as":"rank","op":"rank"}]}.

---

<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 8, 2018, 11:19am UTC](https://discuss.elastic.co/t/kibana-transform-window-rank-not-working-in-vega-v2/145749/4 "2018-10-08T11:19:03Z")

</div>

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