# Kibana url template scripted field

**URL:** <https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050>\
**Category:** Kibana\
**Created:** [March 31, 2023, 1:00pm UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050 "2023-03-31T13:00:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [March 31, 2023, 1:00pm UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050/1 "2023-03-31T13:00:51Z")

</div>

Hello All,

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/7/572fd9149fc33f672382c16cceee4e92165a784f.png)

I've created a scripted field and would like know how can i configure the url host and port dynamically through some external config for 1 specific index pattern?  
intention is not to come in kibana and do it manually everytime,its should be automated through some external config.  
Stuck to understand where to define config and how will it understand to which index pattern it should refer to update .  
kibana 7.9.1

```auto
if (doc['PartDatas.serviceRequestId.keyword'].size() > 0) {
  def requestId = doc['PartDatas.serviceRequestId.keyword'].value;
  def url = 'http:// **abc:8084** /mis-web-ui/#/monitoring/pac-dashboard;requestId=' + requestId;
  return "<a href='" + url + "'>" + requestId + "</a>";
} else {
  return "";
}

```

Thanx

---

<div class="post-metadata">

**Author:** ![jughosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jughosta/32/107160_2.png) [@jughosta](https://discuss.elastic.co/u/jughosta)\
**Post date:** [April 3, 2023, 12:15pm UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050/2 "2023-04-03T12:15:05Z")

</div>

Hi @PRASHANT_MEHTA,

Try using "URL template" input (instead of defining a script) and it will show a link on Discover.

Example URL template based on your description:

```auto
http:// **abc:8084** /mis-web-ui/#/monitoring/pac-dashboard;requestId={­{value}­}

```

---

<div class="post-metadata">

**Author:** ![PRASHANT\_MEHTA](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/prashant_mehta/32/101764_2.png) [@PRASHANT\_MEHTA](https://discuss.elastic.co/u/PRASHANT_MEHTA)\
**Post date:** [April 3, 2023, 12:54pm UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050/3 "2023-04-03T12:54:10Z")

</div>

Hi @jughosta ,

Thanx for your to look into this.  
The url tempalte works for me as static in the solution you recommended.  
The challenege is host and port would be updated frequently and to do such changes user will not come to kibana to do it.I'd like to know a way how this can be managed through some configuration file.  
Setting up env variable in OS and using it is not an option.

Summarize:  
1)Through logstash data parsing i get a field value called "PartDatas.serviceRequestId":"abc"  
2)on click of abc route to configured url  
3)abc and port will be frequently updated and user won't come to kibana and manually update the host and port for this given index pattern.  
4)Now I need to find a way where I can define host and port details and then it should update the url template of particular index pattern with new host or port .

Old implementation:consider you're clicking this and routing to desired url/ url host and port will require frequent update.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/6/d/6dd52e72f0dad30b915b625c66c60f2b0788580f.png)

Thanx

---

<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:** [May 1, 2023, 12:54pm UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050/4 "2023-05-01T12:54:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jughosta](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jughosta/32/107160_2.png) [@jughosta](https://discuss.elastic.co/u/jughosta)\
**Post date:** [May 22, 2023, 10:29am UTC](https://discuss.elastic.co/t/kibana-url-template-scripted-field/329050/5 "2023-05-22T10:29:53Z")

</div>

Such custom configuration is not supported.

For updates over time, please consider using Data View API to update field formatters

> **[Update data view API | Kibana Guide \[master\] | Elastic](https://www.elastic.co/guide/en/kibana/master/data-views-api-update.html)**
>
> Conceptual and step-by-step procedures for using runtime fields, scripted fields, and field formatters.
