# Large scripted field

**URL:** <https://discuss.elastic.co/t/large-scripted-field/107163>\
**Category:** Kibana\
**Created:** [November 10, 2017, 10:20am UTC](https://discuss.elastic.co/t/large-scripted-field/107163 "2017-11-10T10:20:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kumpelblase](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumpelblase/32/35709_2.png) [@kumpelblase](https://discuss.elastic.co/u/kumpelblase)\
**Post date:** [November 10, 2017, 10:20am UTC](https://discuss.elastic.co/t/large-scripted-field/107163/1 "2017-11-10T10:20:09Z")

</div>

I created a scripted field with lots of if statements, which looks like this:

> def status = doc['TTS\_Verantwortlicher'].value;  
> if (status == 2) return 'Kirschner' ;   
> if (status == 4) return 'Gehr' ;   
> if (status == 5) return 'Grande' ;   
> if (status == 8) return 'Scheibli' ;   
> if (status == 10) return 'Meier' ;   
> if (status == 11) return 'Scalegno' ;   
> . . .  
> if (status == 6972) return 'Jurt' ;

Now I get a compile error of Kibana when I click on the discover tab. Is it because of the many if statements and if yes how can I change it? I can't however add a field or change it, as it has to stay as it is.

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [November 10, 2017, 4:16pm UTC](https://discuss.elastic.co/t/large-scripted-field/107163/2 "2017-11-10T16:16:04Z")

</div>

This in my opinion looks like something that would better be added at ingestion time or through reindexing of the data.

---

<div class="post-metadata">

**Author:** ![kumpelblase](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kumpelblase/32/35709_2.png) [@kumpelblase](https://discuss.elastic.co/u/kumpelblase)\
**Post date:** [November 13, 2017, 1:48pm UTC](https://discuss.elastic.co/t/large-scripted-field/107163/3 "2017-11-13T13:48:38Z")

</div>

How would it be possible to reindex these fields, with the change from a number to the matching string?

---

<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 11, 2017, 1:48pm UTC](https://discuss.elastic.co/t/large-scripted-field/107163/4 "2017-12-11T13:48:43Z")

</div>

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