# Visualization Filter

**URL:** https://discuss.elastic.co/t/visualization-filter/78731
**Category:** Kibana
**Created:** [March 15, 2017, 3:12pm UTC](https://discuss.elastic.co/t/visualization-filter/78731 "2017-03-15T15:12:26Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Conall\_Prendergast](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Conall\_Prendergast](https://discuss.elastic.co/u/Conall_Prendergast)
#### Post date: [March 15, 2017, 3:12pm UTC](https://discuss.elastic.co/t/visualization-filter/78731/1 "2017-03-15T15:12:26Z")

</div>

Hi,

I am trying to make a visualization in Kibana that has a filter in it. I decided to do a "script" filter that returns true if two of a documents fields are equal.

I can do the filter in the dev console no bother, but as soon as I try to filter the visualization, it just doesnt work.  
It instead, displays all the data, even the data that should not match the filter.

My kibanaSavedObjectMeta.searchSourceJSON is as follows

```
{
  "index": "index1",
  "filter": {
    "script": {
      "script": {
        "inline": "doc['value1'] == doc['value2']"
      }
    }
  }
}

```

Regards

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [March 16, 2017, 11:46am UTC](https://discuss.elastic.co/t/visualization-filter/78731/2 "2017-03-16T11:46:04Z")

</div>

@Conall_Prendergast the filter should be an array

```auto
{
  "index": "index1",
  "filter": [{
    "script": {
      "script": {
        "inline": "doc['value1'] == doc['value2']"
      }
    }
  }]
}

```

---

<div class="post-metadata">

### Author: ![Conall\_Prendergast](https://avatars.discourse-cdn.com/v4/letter/c/d26b3c/32.png) [@Conall\_Prendergast](https://discuss.elastic.co/u/Conall_Prendergast)
#### Post date: [March 16, 2017, 11:50am UTC](https://discuss.elastic.co/t/visualization-filter/78731/3 "2017-03-16T11:50:14Z")

</div>

@Brandon_Kobel Thanks a million. You're a god among men!

---

<div class="post-metadata">

### Author: ![Brandon\_Kobel](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_kobel/32/14829_2.png) [@Brandon\_Kobel](https://discuss.elastic.co/u/Brandon_Kobel)
#### Post date: [March 16, 2017, 12:01pm UTC](https://discuss.elastic.co/t/visualization-filter/78731/4 "2017-03-16T12:01:47Z")

</div>

@Conall_Prendergast 😊

---

<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: [April 13, 2017, 12:01pm UTC](https://discuss.elastic.co/t/visualization-filter/78731/5 "2017-04-13T12:01:55Z")

</div>

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