# How to create/update fields to URL format?

**URL:** <https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730>\
**Category:** Kibana\
**Created:** [December 2, 2021, 4:47am UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730 "2021-12-02T04:47:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brian661](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian661/32/97953_2.png) [@brian661](https://discuss.elastic.co/u/brian661)\
**Post date:** [December 2, 2021, 4:47am UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730/1 "2021-12-02T04:47:20Z")

</div>

I am trying to build my Kibana and automating the creation of the index patterns.  
For all of the index pattern, I want to update a field to format=URL, and set up the link on it,  
But I am not able to find the api I should use.

The closest is [Update index pattern fields API | Kibana Guide [7.16] | Elastic](https://www.elastic.co/guide/en/kibana/7.16/index-patterns-fields-api-update.html),  
But it is not clear how to set up the url template / label template.

If possible, I want to set it up in the create api, so I can complete it in one request, but seem it is not allowed?

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/f/8/f8606c208e2c72a499b64632113ae65693d0e249.png)

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [December 2, 2021, 8:30pm UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730/2 "2021-12-02T20:30:18Z")

</div>

This is a very good question, I see that the docs need an improvement here. I'll open an issue to improve that.  
In the meantime, you can set the field format manually, check to see how it's saved by using the GET index-pattern API and then use the same formatting in the update.

---

<div class="post-metadata">

**Author:** ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)\
**Post date:** [December 2, 2021, 8:46pm UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730/3 "2021-12-02T20:46:50Z")

</div>

Issue is here, I'll see if I can fix it later today or tomorrow.

> <https://github.com/elastic/kibana/issues/120286>
>
> Currently the documentation doesn't contain an example on how to change a field …format, which seems like the most common use case for this API. 
> https://www.elastic.co/guide/en/kibana/master/data-views-fields-api-update.html

---

<div class="post-metadata">

**Author:** ![brian661](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brian661/32/97953_2.png) [@brian661](https://discuss.elastic.co/u/brian661)\
**Post date:** [December 3, 2021, 5:09am UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730/4 "2021-12-03T05:09:47Z")

</div>

Hi Marius,  
Thanks for your hints and I am able to create the field format using the create index pattern API

```auto
{
  "attributes": {
    "title":"my-pattern-*",
    "timeFieldName":"@timestamp",
    "fieldFormatMap": "{\"some_id\":{\"id\":\"url\",\"params\":{\"urlTemplate\":\"https://somewhere/{{value}}\",\"labelTemplate\":\"{{value}}\"}}}"
  }
}

```

Just something would like to confirm  
if I set a non exist field, the api will still success, and no error or unexpected behavior on Kibana.  
Can I save it is safe to add some filed format for non\_exist field?  
As i have thousand index patterns and may be a few of them is missing a common filed

---

<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 31, 2021, 5:10am UTC](https://discuss.elastic.co/t/how-to-create-update-fields-to-url-format/290730/5 "2021-12-31T05:10:28Z")

</div>

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