# Error in Vega: Invalid field predicate

**URL:** https://discuss.elastic.co/t/error-in-vega-invalid-field-predicate/148629
**Category:** Kibana
**Created:** [September 14, 2018, 1:38pm UTC](https://discuss.elastic.co/t/error-in-vega-invalid-field-predicate/148629 "2018-09-14T13:38:18Z")
**Posts on this page:** 3
**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: [September 14, 2018, 1:38pm UTC](https://discuss.elastic.co/t/error-in-vega-invalid-field-predicate/148629/1 "2018-09-14T13:38:18Z")

</div>

Hi,

I was not able to filter out invalid / zero data for a field in vega. Please help!!

I tried using:  
`{"filter": {"field": "MAX", "valid": true}}`  
or  
`{"filter": {"field": "MAX", "gt": 0}}`

I also tried using the filed before renaming:  
`{"filter": {"field": "datum._source['check_result.perfdata.swap.max']", "valid": true}}`  
or  
`{"filter": {"field": "datum._source['check_result.perfdata.swap.max']", "gt": 0}}`

Still having same error... Please advise what's wrong.

```
{
  $schema: https://vega.github.io/schema/vega-lite/v2.json
  data: {
    url: {
      "%timefield%": "@timestamp"
      index: icinga2-*
      body: {
        size: 10000
        _source: ["@timestamp", "check_result.perfdata.swap.value", "check_result.perfdata.swap.max", "check_command", "host"]
      }
    }
    format: {property: "hits.hits"}
  }
  transform: [
        { calculate: "datum._source['check_result.perfdata.swap.value']/1000000000" as: "USED"},
        { calculate: "datum._source['check_result.perfdata.swap.max']/1000000000" as: "MAX"},
        { calculate: "datum._source['host']" as: "host"},
        { calculate: "datum._source['check_command']" as: "check_command"},
        { calculate: "datum._source['@timestamp']" as: "timestamp"},
        {"filter": {"field": "MAX", "valid": true}}
    ],
      "layer": [
    {
      "selection": {
        "grid": {"type": "interval", "bind": "scales" }
      },
      "mark": "area",
  "encoding": {
    "x": {
      "field": "timestamp", "type": "temporal"
    },
    "y": {
     "field": "MAX","type": "quantitative",
    },
    "color": {"value": "brown"}
  }
  }
  ]
}

```

Error:

`Invalid field predicate: {"field":"MAX","valid":true}`

---

<div class="post-metadata">

### Author: ![nickpeihl](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/nickpeihl/32/112622_2.png) [@nickpeihl](https://discuss.elastic.co/u/nickpeihl)
#### Post date: [September 21, 2018, 6:54pm UTC](https://discuss.elastic.co/t/error-in-vega-invalid-field-predicate/148629/2 "2018-09-21T18:54:25Z")

</div>

> [@perryparktung](#):
>
> {"filter": {"field": "MAX", "valid": true}}

The latest version of Vega-Lite used by Kibana is v2.4.0. The `valid` field predicate is not supported in Vega-Lite v2.4.0 and earlier. You'll want to use a Vega expression instead. Maybe something like this.

```auto
{ filter: "datum.MAX > 0" }

```

---

<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 19, 2018, 6:54pm UTC](https://discuss.elastic.co/t/error-in-vega-invalid-field-predicate/148629/3 "2018-10-19T18:54:27Z")

</div>

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