# JSON input filter for value

**URL:** <https://discuss.elastic.co/t/json-input-filter-for-value/155655>\
**Category:** Kibana\
**Created:** [November 7, 2018, 5:18am UTC](https://discuss.elastic.co/t/json-input-filter-for-value/155655 "2018-11-07T05:18:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [November 7, 2018, 5:18am UTC](https://discuss.elastic.co/t/json-input-filter-for-value/155655/1 "2018-11-07T05:18:28Z")

</div>

Hi,

I've wrote this script to parse with a metric visualization but it doesn't work. I've tried reading the docs but couldn't find how to match values.

`{ "script" : "doc['int_wan'].value = wan1" }`

---

<div class="post-metadata">

**Author:** ![cjcenizal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cjcenizal/32/11216_2.png) [@cjcenizal](https://discuss.elastic.co/u/cjcenizal)\
**Post date:** [November 7, 2018, 11:28pm UTC](https://discuss.elastic.co/t/json-input-filter-for-value/155655/2 "2018-11-07T23:28:15Z")

</div>

Here's how you can compare against the field's value and return different values based on how the condition is evaluated:

```auto
{ "script" : "if (_value < 300) { return 200; } return 400" }

```

---

<div class="post-metadata">

**Author:** ![Sjaak01](https://avatars.discourse-cdn.com/v4/letter/s/73ab20/32.png) [@Sjaak01](https://discuss.elastic.co/u/Sjaak01)\
**Post date:** [November 8, 2018, 4:33am UTC](https://discuss.elastic.co/t/json-input-filter-for-value/155655/3 "2018-11-08T04:33:33Z")

</div>

I don't want to return a different value though, I want to match field values.

E.g. I have a metric with 4 different sums, each summing the total of bytes. What I want to do is use the JSON input to filter the same based on the interface. WAN1, WAN2, etc.

---

<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:** [December 6, 2018, 4:33am UTC](https://discuss.elastic.co/t/json-input-filter-for-value/155655/4 "2018-12-06T04:33:41Z")

</div>

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