# How to 'filter' in Discover when the field is a scripted field

**URL:** <https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890>\
**Category:** Kibana\
**Created:** [October 23, 2019, 2:13pm UTC](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890 "2019-10-23T14:13:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ssingh12](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@Ssingh12](https://discuss.elastic.co/u/Ssingh12)\
**Post date:** [October 23, 2019, 2:13pm UTC](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890/1 "2019-10-23T14:13:30Z")

</div>

I have a Discover table which contains several scripted fields. When I click on the a cell (corresponding to a scripted field) to filter values - nothing happens. I do see a filter query getting created, but it does not function. I also do not see any error message.  
Could I be doing something wrong, or it is a not a capability within Kibana yet.

Below is the DSL snipped I get after adding a filter by clicking on a cell -

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/0/5069caadd90c7fc13bb9aaf1c724e38d598af52c.png)

Background - I had to create scripted fields because I wanted to give my fields a prettier name.

---

<div class="post-metadata">

**Author:** ![Larry\_Gregory](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/larry_gregory/32/34969_2.png) [@Larry\_Gregory](https://discuss.elastic.co/u/Larry_Gregory)\
**Post date:** [October 23, 2019, 2:29pm UTC](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890/2 "2019-10-23T14:29:41Z")

</div>

Hey @Ssingh12,

I believe you've run into a known limitation with scripted fields. Your specific script defines an inline function (`compare`), and we recently discovered that this isn't supported when used inside a filter.

See related discussion here: [Getting a no\_viable\_alt\_exception only when trying to filter using a scripted field](https://discuss.elastic.co/t/getting-a-no-viable-alt-exception-only-when-trying-to-filter-using-a-scripted-field/183145/4)

---

<div class="post-metadata">

**Author:** ![Ssingh12](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@Ssingh12](https://discuss.elastic.co/u/Ssingh12)\
**Post date:** [October 24, 2019, 6:33am UTC](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890/3 "2019-10-24T06:33:59Z")

</div>

Hi @Larry_Gregory, great input. I did not understand the discussion nicely as I am a beginner. I am gathering that what I am trying won't work.  
I will have to look around for workarounds.

---

<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:** [November 21, 2019, 6:34am UTC](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890/4 "2019-11-21T06:34:11Z")

</div>

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