# Kibana scripted field url formatting with a string

**URL:** <https://discuss.elastic.co/t/kibana-scripted-field-url-formatting-with-a-string/24849>\
**Category:** Kibana\
**Created:** [July 3, 2015, 8:58am UTC](https://discuss.elastic.co/t/kibana-scripted-field-url-formatting-with-a-string/24849 "2015-07-03T08:58:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcin\_K](https://avatars.discourse-cdn.com/v4/letter/m/8dc957/32.png) [@Marcin\_K](https://discuss.elastic.co/u/Marcin_K)\
**Post date:** [July 3, 2015, 8:58am UTC](https://discuss.elastic.co/t/kibana-scripted-field-url-formatting-with-a-string/24849/1 "2015-07-03T08:58:52Z")

</div>

Hello,  
I love new kibana 4 feature that allows me to create URL based on variables. It's brilliant thank for that.  
It works just fine when I use number value doc['variable'].value or like this \_source.variable

But when I reference string value I get errors.  
Is there any other way apart from duplicating the variable in elasticsearch and formatting it directly as new\_variable  
to achieve something like that ?

Thanks & regards  
Marcin

---

<div class="post-metadata">

**Author:** ![tbragin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/tbragin/32/45166_2.png) [@tbragin](https://discuss.elastic.co/u/tbragin)\
**Post date:** [July 4, 2015, 3:35pm UTC](https://discuss.elastic.co/t/kibana-scripted-field-url-formatting-with-a-string/24849/2 "2015-07-04T15:35:23Z")

</div>

The default language for Kibana scripted fields is [Lucene expressions](http://lucene.apache.org/core/4_9_0/expressions/index.html?org/apache/lucene/expressions/js/package-summary.html), which can only work with integers at this time.

You can instead use Groovy scripts, which can operate on strings, but take care to do so in a secure manner (dynamic scripts are insecure, so you must use static scripts). More on that in this thread: [Calling groovy script from Kibana](https://discuss.elastic.co/t/calling-groovy-script-from-kibana/2542/6)

---

<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:** [July 6, 2017, 2:17pm UTC](https://discuss.elastic.co/t/kibana-scripted-field-url-formatting-with-a-string/24849/3 "2017-07-06T14:17:05Z")

</div>


