# 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:** 1\
**Showing post:** 2

<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)

---

_[View the full topic](https://discuss.elastic.co/t/how-to-filter-in-discover-when-the-field-is-a-scripted-field/204890)._
