# Unable to use scripted fields with Kibana 7.2

**URL:** <https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037>\
**Category:** Kibana\
**Created:** [July 17, 2019, 3:05pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037 "2019-07-17T15:05:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tturpin](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tturpin](https://discuss.elastic.co/u/tturpin)\
**Post date:** [July 17, 2019, 3:05pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037/1 "2019-07-17T15:05:46Z")

</div>

We recently upgraded from Kibana 6.5.1 to 7.2. I'm having very strange behavior with my scripted fields. I'm unable to view any of my searches on the Discover tab. I get an error that states "1 of 161 shards failed", but when I go to my dashboard everything displays as expected.

I deleted my scripted fields and received the error below during the delete. When I went back to the Discover tab, my searches started working. I am not using the toLowerCase function in my scripted fields.

Version: 7.2.0  
Build: 24337  
Error: Uncaught TypeError: (filter || "").toLowerCase is not a function (https:{servername}/built\_assets/dlls/vendors.bundle.dll.js.233) at window.onerror (https://{servername}/bundles/commons.bundle.js:3:1630366)

Any ideas?

---

<div class="post-metadata">

**Author:** ![lukas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/lukas/32/6812_2.png) [@lukas](https://discuss.elastic.co/u/lukas)\
**Post date:** [July 17, 2019, 11:53pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037/2 "2019-07-17T23:53:21Z")

</div>

Could you provide the script that you're using as well as a sample of what your data/scripted field looks like?

---

<div class="post-metadata">

**Author:** ![tturpin](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tturpin](https://discuss.elastic.co/u/tturpin)\
**Post date:** [July 18, 2019, 12:51pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037/3 "2019-07-18T12:51:12Z")

</div>

def statusStr = doc['mdc.responseHttpStatus.keyword'].value;  
if(statusStr != null && statusStr != "")  
{  
def status = Integer.parseInt(statusStr);  
if(status \>= 200 && status \< 300)  
{  
return "Success";  
}  
else  
{  
return "Failed";  
}  
}

It worked fine in 6.5.1.

I want to return Success if it was a successful http code and Failed if it was not. I'm using this for a metric visualization.

---

<div class="post-metadata">

**Author:** ![tturpin](https://avatars.discourse-cdn.com/v4/letter/t/50afbb/32.png) [@tturpin](https://discuss.elastic.co/u/tturpin)\
**Post date:** [July 24, 2019, 7:29pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037/4 "2019-07-24T19:29:22Z")

</div>

Has anyone else had issues with scripted fields in Kibana 7.2?

---

<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:** [August 21, 2019, 7:29pm UTC](https://discuss.elastic.co/t/unable-to-use-scripted-fields-with-kibana-7-2/191037/5 "2019-08-21T19:29:27Z")

</div>

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