How to create/update fields to URL format?

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,
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?

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.

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

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

  "attributes": {
    "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

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